5 #include <linux/stddef.h>
6 #include <linux/types.h>
7 #include <linux/cache.h>
8 #include <linux/threads.h>
10 #include <asm/percpu.h>
12 /* Per processor datastructure. %gs points to it while the kernel runs */
14 struct task_struct
*pcurrent
; /* 0 Current process */
16 unsigned long kernelstack
; /* 16 top of kernel stack for current */
17 unsigned long oldrsp
; /* 24 user rsp for system call */
18 int irqcount
; /* 32 Irq nesting counter. Starts -1 */
19 unsigned int cpunumber
; /* 36 Logical CPU number */
20 #ifdef CONFIG_CC_STACKPROTECTOR
21 unsigned long stack_canary
; /* 40 stack canary value */
22 /* gcc-ABI: this canary MUST be at
26 short nodenumber
; /* number of current node (32k max) */
27 short in_bootmem
; /* pda lives in bootmem */
30 struct mm_struct
*active_mm
;
31 } ____cacheline_aligned_in_smp
;
33 DECLARE_PER_CPU(struct x8664_pda
, __pda
);
34 extern void pda_init(int);
36 #define cpu_pda(cpu) (&per_cpu(__pda, cpu))
38 #define read_pda(field) percpu_read(__pda.field)
39 #define write_pda(field, val) percpu_write(__pda.field, val)
40 #define add_pda(field, val) percpu_add(__pda.field, val)
41 #define sub_pda(field, val) percpu_sub(__pda.field, val)
42 #define or_pda(field, val) percpu_or(__pda.field, val)
44 /* This is not atomic against other CPUs -- CPU preemption needs to be off */
45 #define test_and_clear_bit_pda(bit, field) \
46 x86_test_and_clear_bit_percpu(bit, __pda.field)
50 #define PDA_STACKOFFSET (5*8)
52 #endif /* _ASM_X86_PDA_H */