Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 #ifndef _ASM_POWERPC_CURRENT_H
0003 #define _ASM_POWERPC_CURRENT_H
0004 #ifdef __KERNEL__
0005 
0006 /*
0007  */
0008 
0009 struct task_struct;
0010 
0011 #ifdef __powerpc64__
0012 #include <linux/stddef.h>
0013 #include <asm/paca.h>
0014 
0015 static inline struct task_struct *get_current(void)
0016 {
0017     struct task_struct *task;
0018 
0019     /* get_current can be cached by the compiler, so no volatile */
0020     asm ("ld %0,%1(13)"
0021     : "=r" (task)
0022     : "i" (offsetof(struct paca_struct, __current)));
0023 
0024     return task;
0025 }
0026 #define current get_current()
0027 
0028 #else
0029 
0030 /*
0031  * We keep `current' in r2 for speed.
0032  */
0033 register struct task_struct *current asm ("r2");
0034 
0035 #endif
0036 
0037 #endif /* __KERNEL__ */
0038 #endif /* _ASM_POWERPC_CURRENT_H */