1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2a439fe51SSam Ravnborg /* include/asm/current.h 3a439fe51SSam Ravnborg * 4a439fe51SSam Ravnborg * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation 5a439fe51SSam Ravnborg * Copyright (C) 2002 Pete Zaitcev (zaitcev@yahoo.com) 6a439fe51SSam Ravnborg * Copyright (C) 2007 David S. Miller (davem@davemloft.net) 7a439fe51SSam Ravnborg * 8a439fe51SSam Ravnborg * Derived from "include/asm-s390/current.h" by 9a439fe51SSam Ravnborg * Martin Schwidefsky (schwidefsky@de.ibm.com) 10a439fe51SSam Ravnborg * Derived from "include/asm-i386/current.h" 11a439fe51SSam Ravnborg */ 12a439fe51SSam Ravnborg #ifndef _SPARC_CURRENT_H 13a439fe51SSam Ravnborg #define _SPARC_CURRENT_H 14a439fe51SSam Ravnborg 15a439fe51SSam Ravnborg #include <linux/thread_info.h> 16a439fe51SSam Ravnborg 17a439fe51SSam Ravnborg #ifdef CONFIG_SPARC64 18a439fe51SSam Ravnborg register struct task_struct *current asm("g4"); 19a439fe51SSam Ravnborg #endif 20a439fe51SSam Ravnborg 21a439fe51SSam Ravnborg #ifdef CONFIG_SPARC32 22a439fe51SSam Ravnborg /* We might want to consider using %g4 like sparc64 to shave a few cycles. 23a439fe51SSam Ravnborg * 24a439fe51SSam Ravnborg * Two stage process (inline + #define) for type-checking. 25a439fe51SSam Ravnborg * We also obfuscate get_current() to check if anyone used that by mistake. 26a439fe51SSam Ravnborg */ 27a439fe51SSam Ravnborg struct task_struct; __get_current(void)28a439fe51SSam Ravnborgstatic inline struct task_struct *__get_current(void) 29a439fe51SSam Ravnborg { 30a439fe51SSam Ravnborg return current_thread_info()->task; 31a439fe51SSam Ravnborg } 32a439fe51SSam Ravnborg #define current __get_current() 33a439fe51SSam Ravnborg #endif 34a439fe51SSam Ravnborg 35a439fe51SSam Ravnborg #endif /* !(_SPARC_CURRENT_H) */ 36