| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Based on arm/arm64/include/asm/current.h |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2016 ARM |
|---|
| 5 | 6 | * Copyright (C) 2017 SiFive |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or |
|---|
| 8 | | - * modify it under the terms of the GNU General Public License |
|---|
| 9 | | - * as published by the Free Software Foundation, version 2. |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | | - * GNU General Public License for more details. |
|---|
| 15 | 7 | */ |
|---|
| 16 | 8 | |
|---|
| 17 | 9 | |
|---|
| 18 | | -#ifndef __ASM_CURRENT_H |
|---|
| 19 | | -#define __ASM_CURRENT_H |
|---|
| 10 | +#ifndef _ASM_RISCV_CURRENT_H |
|---|
| 11 | +#define _ASM_RISCV_CURRENT_H |
|---|
| 20 | 12 | |
|---|
| 21 | 13 | #include <linux/bug.h> |
|---|
| 22 | 14 | #include <linux/compiler.h> |
|---|
| .. | .. |
|---|
| 24 | 16 | #ifndef __ASSEMBLY__ |
|---|
| 25 | 17 | |
|---|
| 26 | 18 | struct task_struct; |
|---|
| 19 | + |
|---|
| 20 | +register struct task_struct *riscv_current_is_tp __asm__("tp"); |
|---|
| 27 | 21 | |
|---|
| 28 | 22 | /* |
|---|
| 29 | 23 | * This only works because "struct thread_info" is at offset 0 from "struct |
|---|
| .. | .. |
|---|
| 34 | 28 | */ |
|---|
| 35 | 29 | static __always_inline struct task_struct *get_current(void) |
|---|
| 36 | 30 | { |
|---|
| 37 | | - register struct task_struct *tp __asm__("tp"); |
|---|
| 38 | | - return tp; |
|---|
| 31 | + return riscv_current_is_tp; |
|---|
| 39 | 32 | } |
|---|
| 40 | 33 | |
|---|
| 41 | 34 | #define current get_current() |
|---|
| 42 | 35 | |
|---|
| 43 | 36 | #endif /* __ASSEMBLY__ */ |
|---|
| 44 | 37 | |
|---|
| 45 | | -#endif /* __ASM_CURRENT_H */ |
|---|
| 38 | +#endif /* _ASM_RISCV_CURRENT_H */ |
|---|