diff mbox

x86: LLVMLinux: Reimplement current_stack_pointer without register usage.

Message ID 1392957882-24105-1-git-send-email-behanw@converseincode.com
State New
Headers show

Commit Message

Behan Webster Feb. 21, 2014, 4:44 a.m. UTC
From: Behan Webster <behanw@converseincode.com>

Use asm to make the globally named register work again for gcc and clang.
Much more efficient than copying the stack pointer to a variable and back again.

Signed-off-by: Behan Webster <behanw@converseincode.com>
---
 arch/x86/include/asm/thread_info.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index e1940c0..e27ccc1 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -163,10 +163,10 @@  struct thread_info {
  */
 #ifndef __ASSEMBLY__
 
-#define current_stack_pointer ({		\
-	unsigned long sp;			\
-	asm("mov %%esp,%0" : "=g" (sp));	\
-	sp;					\
+#define current_stack_pointer ({			\
+	register unsigned long sp asm("esp") __used;	\
+	asm("" : "=r" (sp));				\
+	sp;						\
 })
 
 /* how to get the thread information struct from C */