pda.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef _ASM_X86_PDA_H
  2. #define _ASM_X86_PDA_H
  3. #ifndef __ASSEMBLY__
  4. #include <linux/stddef.h>
  5. #include <linux/types.h>
  6. #include <linux/cache.h>
  7. #include <linux/threads.h>
  8. #include <asm/page.h>
  9. #include <asm/percpu.h>
  10. /* Per processor datastructure. %gs points to it while the kernel runs */
  11. struct x8664_pda {
  12. unsigned long unused1;
  13. unsigned long unused2;
  14. unsigned long kernelstack; /* 16 top of kernel stack for current */
  15. unsigned long oldrsp; /* 24 user rsp for system call */
  16. int irqcount; /* 32 Irq nesting counter. Starts -1 */
  17. unsigned int unused6; /* 36 was cpunumber */
  18. #ifdef CONFIG_CC_STACKPROTECTOR
  19. unsigned long stack_canary; /* 40 stack canary value */
  20. /* gcc-ABI: this canary MUST be at
  21. offset 40!!! */
  22. #endif
  23. short nodenumber; /* number of current node (32k max) */
  24. short in_bootmem; /* pda lives in bootmem */
  25. short isidle;
  26. } ____cacheline_aligned_in_smp;
  27. DECLARE_PER_CPU(struct x8664_pda, __pda);
  28. extern void pda_init(int);
  29. #define cpu_pda(cpu) (&per_cpu(__pda, cpu))
  30. #define read_pda(field) percpu_read(__pda.field)
  31. #define write_pda(field, val) percpu_write(__pda.field, val)
  32. #define add_pda(field, val) percpu_add(__pda.field, val)
  33. #define sub_pda(field, val) percpu_sub(__pda.field, val)
  34. #define or_pda(field, val) percpu_or(__pda.field, val)
  35. /* This is not atomic against other CPUs -- CPU preemption needs to be off */
  36. #define test_and_clear_bit_pda(bit, field) \
  37. x86_test_and_clear_bit_percpu(bit, __pda.field)
  38. #endif
  39. #define PDA_STACKOFFSET (5*8)
  40. #endif /* _ASM_X86_PDA_H */