pda.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. struct task_struct *pcurrent; /* 0 Current process */
  13. unsigned long dummy;
  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 cpunumber; /* 36 Logical CPU number */
  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. char *irqstackptr;
  24. short nodenumber; /* number of current node (32k max) */
  25. short in_bootmem; /* pda lives in bootmem */
  26. short isidle;
  27. } ____cacheline_aligned_in_smp;
  28. DECLARE_PER_CPU(struct x8664_pda, __pda);
  29. extern void pda_init(int);
  30. #define cpu_pda(cpu) (&per_cpu(__pda, cpu))
  31. #define read_pda(field) percpu_read(__pda.field)
  32. #define write_pda(field, val) percpu_write(__pda.field, val)
  33. #define add_pda(field, val) percpu_add(__pda.field, val)
  34. #define sub_pda(field, val) percpu_sub(__pda.field, val)
  35. #define or_pda(field, val) percpu_or(__pda.field, val)
  36. /* This is not atomic against other CPUs -- CPU preemption needs to be off */
  37. #define test_and_clear_bit_pda(bit, field) \
  38. x86_test_and_clear_bit_percpu(bit, __pda.field)
  39. #endif
  40. #define PDA_STACKOFFSET (5*8)
  41. #endif /* _ASM_X86_PDA_H */