diff options
Diffstat (limited to 'arch/powerpc/include/asm/thread_info.h')
| -rw-r--r-- | arch/powerpc/include/asm/thread_info.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h index ebc4f165690a..0be6c681cab1 100644 --- a/arch/powerpc/include/asm/thread_info.h +++ b/arch/powerpc/include/asm/thread_info.h | |||
| @@ -23,9 +23,9 @@ | |||
| 23 | #define THREAD_SIZE (1 << THREAD_SHIFT) | 23 | #define THREAD_SIZE (1 << THREAD_SHIFT) |
| 24 | 24 | ||
| 25 | #ifdef CONFIG_PPC64 | 25 | #ifdef CONFIG_PPC64 |
| 26 | #define CURRENT_THREAD_INFO(dest, sp) clrrdi dest, sp, THREAD_SHIFT | 26 | #define CURRENT_THREAD_INFO(dest, sp) stringify_in_c(clrrdi dest, sp, THREAD_SHIFT) |
| 27 | #else | 27 | #else |
| 28 | #define CURRENT_THREAD_INFO(dest, sp) rlwinm dest, sp, 0, 0, 31-THREAD_SHIFT | 28 | #define CURRENT_THREAD_INFO(dest, sp) stringify_in_c(rlwinm dest, sp, 0, 0, 31-THREAD_SHIFT) |
| 29 | #endif | 29 | #endif |
| 30 | 30 | ||
| 31 | #ifndef __ASSEMBLY__ | 31 | #ifndef __ASSEMBLY__ |
| @@ -71,12 +71,13 @@ struct thread_info { | |||
| 71 | #define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) | 71 | #define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) |
| 72 | 72 | ||
| 73 | /* how to get the thread information struct from C */ | 73 | /* how to get the thread information struct from C */ |
| 74 | register unsigned long __current_r1 asm("r1"); | ||
| 75 | static inline struct thread_info *current_thread_info(void) | 74 | static inline struct thread_info *current_thread_info(void) |
| 76 | { | 75 | { |
| 77 | /* gcc4, at least, is smart enough to turn this into a single | 76 | unsigned long val; |
| 78 | * rlwinm for ppc32 and clrrdi for ppc64 */ | 77 | |
| 79 | return (struct thread_info *)(__current_r1 & ~(THREAD_SIZE-1)); | 78 | asm (CURRENT_THREAD_INFO(%0,1) : "=r" (val)); |
| 79 | |||
| 80 | return (struct thread_info *)val; | ||
| 80 | } | 81 | } |
| 81 | 82 | ||
| 82 | #endif /* __ASSEMBLY__ */ | 83 | #endif /* __ASSEMBLY__ */ |
