]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - arch/x86/include/asm/pda.h
x86-64: Move kernelstack from PDA to per-cpu.
[mirror_ubuntu-artful-kernel.git] / arch / x86 / include / asm / pda.h
CommitLineData
1965aae3
PA
1#ifndef _ASM_X86_PDA_H
2#define _ASM_X86_PDA_H
1da177e4
LT
3
4#ifndef __ASSEMBLY__
5#include <linux/stddef.h>
6#include <linux/types.h>
7#include <linux/cache.h>
c8f3329a 8#include <linux/threads.h>
b556b35e 9#include <asm/page.h>
b12d8db8 10#include <asm/percpu.h>
1da177e4 11
fe758fb1 12/* Per processor datastructure. %gs points to it while the kernel runs */
1da177e4 13struct x8664_pda {
c6f5e0ac
BG
14 unsigned long unused1;
15 unsigned long unused2;
9af45651 16 unsigned long unused3;
fe758fb1
CG
17 unsigned long oldrsp; /* 24 user rsp for system call */
18 int irqcount; /* 32 Irq nesting counter. Starts -1 */
ea927906 19 unsigned int unused6; /* 36 was cpunumber */
0a425405
AV
20#ifdef CONFIG_CC_STACKPROTECTOR
21 unsigned long stack_canary; /* 40 stack canary value */
22 /* gcc-ABI: this canary MUST be at
23 offset 40!!! */
24#endif
3461b0af
MT
25 short nodenumber; /* number of current node (32k max) */
26 short in_bootmem; /* pda lives in bootmem */
a15da49d 27 short isidle;
b9169116 28} ____cacheline_aligned_in_smp;
1da177e4 29
b12d8db8 30DECLARE_PER_CPU(struct x8664_pda, __pda);
40fec50a 31extern void pda_init(int);
df79efde 32
b12d8db8 33#define cpu_pda(cpu) (&per_cpu(__pda, cpu))
1da177e4 34
6dbde353
IM
35#define read_pda(field) percpu_read(__pda.field)
36#define write_pda(field, val) percpu_write(__pda.field, val)
37#define add_pda(field, val) percpu_add(__pda.field, val)
38#define sub_pda(field, val) percpu_sub(__pda.field, val)
39#define or_pda(field, val) percpu_or(__pda.field, val)
1da177e4 40
9446868b 41/* This is not atomic against other CPUs -- CPU preemption needs to be off */
46e1abc6 42#define test_and_clear_bit_pda(bit, field) \
49357d19 43 x86_test_and_clear_bit_percpu(bit, __pda.field)
9446868b 44
1da177e4
LT
45#endif
46
1965aae3 47#endif /* _ASM_X86_PDA_H */