aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2014-10-30 23:47:25 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2014-11-09 17:59:31 -0500
commita3e5b356b3ab40b00ecb0f6fde445db719c100b5 (patch)
treea330444b01df40d2f4a403ee61fd0f33623e5949
parente88f157de5e0b327b1b26e3260de4b16c07e2d19 (diff)
powerpc: Don't use local named register variable in current_thread_info
LLVM doesn't support local named register variables and is unlikely to. current_thread_info is using one, fix it by moving it out and calling it __current_r1(). I gave it a bit of an obscure name because we don't want anyone else using it - they should use current_stack_pointer(). This specific case is performance critical and we can't afford to call a function to get it. Furthermore it isn't important to know exactly where in the stack we are since we mask the lower bits. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--arch/powerpc/include/asm/thread_info.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
index b034ecdb7c74..ebc4f165690a 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -71,13 +71,12 @@ 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 */
74register unsigned long __current_r1 asm("r1");
74static inline struct thread_info *current_thread_info(void) 75static inline struct thread_info *current_thread_info(void)
75{ 76{
76 register unsigned long sp asm("r1");
77
78 /* gcc4, at least, is smart enough to turn this into a single 77 /* gcc4, at least, is smart enough to turn this into a single
79 * rlwinm for ppc32 and clrrdi for ppc64 */ 78 * rlwinm for ppc32 and clrrdi for ppc64 */
80 return (struct thread_info *)(sp & ~(THREAD_SIZE-1)); 79 return (struct thread_info *)(__current_r1 & ~(THREAD_SIZE-1));
81} 80}
82 81
83#endif /* __ASSEMBLY__ */ 82#endif /* __ASSEMBLY__ */