hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/arch/riscv/include/asm/current.h
....@@ -1,22 +1,14 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Based on arm/arm64/include/asm/current.h
34 *
45 * Copyright (C) 2016 ARM
56 * 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.
157 */
168
179
18
-#ifndef __ASM_CURRENT_H
19
-#define __ASM_CURRENT_H
10
+#ifndef _ASM_RISCV_CURRENT_H
11
+#define _ASM_RISCV_CURRENT_H
2012
2113 #include <linux/bug.h>
2214 #include <linux/compiler.h>
....@@ -24,6 +16,8 @@
2416 #ifndef __ASSEMBLY__
2517
2618 struct task_struct;
19
+
20
+register struct task_struct *riscv_current_is_tp __asm__("tp");
2721
2822 /*
2923 * This only works because "struct thread_info" is at offset 0 from "struct
....@@ -34,12 +28,11 @@
3428 */
3529 static __always_inline struct task_struct *get_current(void)
3630 {
37
- register struct task_struct *tp __asm__("tp");
38
- return tp;
31
+ return riscv_current_is_tp;
3932 }
4033
4134 #define current get_current()
4235
4336 #endif /* __ASSEMBLY__ */
4437
45
-#endif /* __ASM_CURRENT_H */
38
+#endif /* _ASM_RISCV_CURRENT_H */