Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __ASM_CURRENT_H
0003 #define __ASM_CURRENT_H
0004 
0005 #include <linux/compiler.h>
0006 
0007 #ifndef __ASSEMBLY__
0008 
0009 struct task_struct;
0010 
0011 /*
0012  * We don't use read_sysreg() as we want the compiler to cache the value where
0013  * possible.
0014  */
0015 static __always_inline struct task_struct *get_current(void)
0016 {
0017     unsigned long sp_el0;
0018 
0019     asm ("mrs %0, sp_el0" : "=r" (sp_el0));
0020 
0021     return (struct task_struct *)sp_el0;
0022 }
0023 
0024 #define current get_current()
0025 
0026 #endif /* __ASSEMBLY__ */
0027 
0028 #endif /* __ASM_CURRENT_H */
0029