current.h 706 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef ASM_X86__CURRENT_H
  2. #define ASM_X86__CURRENT_H
  3. #ifdef CONFIG_X86_32
  4. #include <linux/compiler.h>
  5. #include <asm/percpu.h>
  6. struct task_struct;
  7. DECLARE_PER_CPU(struct task_struct *, current_task);
  8. static __always_inline struct task_struct *get_current(void)
  9. {
  10. return x86_read_percpu(current_task);
  11. }
  12. #else /* X86_32 */
  13. #ifndef __ASSEMBLY__
  14. #include <asm/pda.h>
  15. struct task_struct;
  16. static __always_inline struct task_struct *get_current(void)
  17. {
  18. return read_pda(pcurrent);
  19. }
  20. #else /* __ASSEMBLY__ */
  21. #include <asm/asm-offsets.h>
  22. #define GET_CURRENT(reg) movq %gs:(pda_pcurrent),reg
  23. #endif /* __ASSEMBLY__ */
  24. #endif /* X86_32 */
  25. #define current get_current()
  26. #endif /* ASM_X86__CURRENT_H */