current.h 478 B

12345678910111213141516171819202122232425262728
  1. #ifndef __ASM_CURRENT_H
  2. #define __ASM_CURRENT_H
  3. #include <linux/compiler.h>
  4. #ifndef __ASSEMBLY__
  5. struct task_struct;
  6. /*
  7. * We don't use read_sysreg() as we want the compiler to cache the value where
  8. * possible.
  9. */
  10. static __always_inline struct task_struct *get_current(void)
  11. {
  12. unsigned long sp_el0;
  13. asm ("mrs %0, sp_el0" : "=r" (sp_el0));
  14. return (struct task_struct *)sp_el0;
  15. }
  16. #define current get_current()
  17. #endif /* __ASSEMBLY__ */
  18. #endif /* __ASM_CURRENT_H */