From: behanw@converseincode.com
To: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com,
x86@kernel.org, peterz@infradead.org, ak@linux.intel.com,
oleg@redhat.com
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
Behan Webster <behanw@converseincode.com>
Subject: [PATCH] x86: LLVMLinux: Reimplement current_stack_pointer without register usage.
Date: Thu, 20 Feb 2014 20:44:42 -0800 [thread overview]
Message-ID: <1392957882-24105-1-git-send-email-behanw@converseincode.com> (raw)
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
next reply other threads:[~2014-02-21 4:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-21 4:44 behanw [this message]
2014-02-21 4:55 ` H. Peter Anvin
2014-02-26 3:00 ` Andy Lutomirski
2014-02-26 3:03 ` H. Peter Anvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1392957882-24105-1-git-send-email-behanw@converseincode.com \
--to=behanw@converseincode.com \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®