1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */ 2*4882a593Smuzhiyun #ifndef _ASM_POWERPC_CURRENT_H 3*4882a593Smuzhiyun #define _ASM_POWERPC_CURRENT_H 4*4882a593Smuzhiyun #ifdef __KERNEL__ 5*4882a593Smuzhiyun 6*4882a593Smuzhiyun /* 7*4882a593Smuzhiyun */ 8*4882a593Smuzhiyun 9*4882a593Smuzhiyun struct task_struct; 10*4882a593Smuzhiyun 11*4882a593Smuzhiyun #ifdef __powerpc64__ 12*4882a593Smuzhiyun #include <linux/stddef.h> 13*4882a593Smuzhiyun #include <asm/paca.h> 14*4882a593Smuzhiyun get_current(void)15*4882a593Smuzhiyunstatic inline struct task_struct *get_current(void) 16*4882a593Smuzhiyun { 17*4882a593Smuzhiyun struct task_struct *task; 18*4882a593Smuzhiyun 19*4882a593Smuzhiyun /* get_current can be cached by the compiler, so no volatile */ 20*4882a593Smuzhiyun asm ("ld %0,%1(13)" 21*4882a593Smuzhiyun : "=r" (task) 22*4882a593Smuzhiyun : "i" (offsetof(struct paca_struct, __current))); 23*4882a593Smuzhiyun 24*4882a593Smuzhiyun return task; 25*4882a593Smuzhiyun } 26*4882a593Smuzhiyun #define current get_current() 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun #else 29*4882a593Smuzhiyun 30*4882a593Smuzhiyun /* 31*4882a593Smuzhiyun * We keep `current' in r2 for speed. 32*4882a593Smuzhiyun */ 33*4882a593Smuzhiyun register struct task_struct *current asm ("r2"); 34*4882a593Smuzhiyun 35*4882a593Smuzhiyun #endif 36*4882a593Smuzhiyun 37*4882a593Smuzhiyun #endif /* __KERNEL__ */ 38*4882a593Smuzhiyun #endif /* _ASM_POWERPC_CURRENT_H */ 39