Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
1965aae3 PA |
2 | #ifndef _ASM_X86_CURRENT_H |
3 | #define _ASM_X86_CURRENT_H | |
f0766440 | 4 | |
f0766440 | 5 | #include <linux/compiler.h> |
f0766440 | 6 | |
c6f5e0ac | 7 | #ifndef __ASSEMBLY__ |
e57ef2ed TG |
8 | |
9 | #include <linux/cache.h> | |
10 | #include <asm/percpu.h> | |
11 | ||
f0766440 CL |
12 | struct task_struct; |
13 | ||
e57ef2ed TG |
14 | struct pcpu_hot { |
15 | union { | |
16 | struct { | |
17 | struct task_struct *current_task; | |
64701838 | 18 | int preempt_count; |
7443b296 | 19 | int cpu_number; |
c063a217 | 20 | unsigned long top_of_stack; |
e57ef2ed TG |
21 | }; |
22 | u8 pad[64]; | |
23 | }; | |
24 | }; | |
25 | static_assert(sizeof(struct pcpu_hot) == 64); | |
26 | ||
27 | DECLARE_PER_CPU_ALIGNED(struct pcpu_hot, pcpu_hot); | |
f0766440 CL |
28 | |
29 | static __always_inline struct task_struct *get_current(void) | |
30 | { | |
e57ef2ed | 31 | return this_cpu_read_stable(pcpu_hot.current_task); |
f0766440 CL |
32 | } |
33 | ||
c6f5e0ac | 34 | #define current get_current() |
f0766440 CL |
35 | |
36 | #endif /* __ASSEMBLY__ */ | |
37 | ||
1965aae3 | 38 | #endif /* _ASM_X86_CURRENT_H */ |