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