2 * Based on arm/arm64/include/asm/current.h
4 * Copyright (C) 2016 ARM
5 * Copyright (C) 2017 SiFive
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.
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.
18 #ifndef __ASM_CURRENT_H
19 #define __ASM_CURRENT_H
21 #include <linux/bug.h>
22 #include <linux/compiler.h>
29 * This only works because "struct thread_info" is at offset 0 from "struct
30 * task_struct". This constraint seems to be necessary on other architectures
31 * as well, but __switch_to enforces it. We can't check TASK_TI here because
32 * <asm/asm-offsets.h> includes this, and I can't get the definition of "struct
33 * task_struct" here due to some header ordering problems.
35 static __always_inline
struct task_struct
*get_current(void)
37 register struct task_struct
*tp
__asm__("tp");
41 #define current get_current()
43 #endif /* __ASSEMBLY__ */
45 #endif /* __ASM_CURRENT_H */