public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: LLVMLinux: Reimplement current_stack_pointer without register usage.
@ 2014-02-21  4:44 behanw
  2014-02-21  4:55 ` H. Peter Anvin
  0 siblings, 1 reply; 4+ messages in thread
From: behanw @ 2014-02-21  4:44 UTC (permalink / raw)
  To: tglx, mingo, hpa, x86, peterz, ak, oleg; +Cc: akpm, linux-kernel, Behan Webster

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 --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 */
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-02-26  3:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-21  4:44 [PATCH] x86: LLVMLinux: Reimplement current_stack_pointer without register usage behanw
2014-02-21  4:55 ` H. Peter Anvin
2014-02-26  3:00   ` Andy Lutomirski
2014-02-26  3:03     ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox