aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/include/asm/thread_info.h
diff options
context:
space:
mode:
authorAndy Lutomirski <luto@amacapital.net>2014-11-13 15:57:07 -0800
committerAndy Lutomirski <luto@amacapital.net>2015-01-02 10:22:46 -0800
commit83653c16da91112236292871b820cb8b367220e3 (patch)
tree1b4155808ca58628d39283073da627529bd4ad9f /arch/x86/include/asm/thread_info.h
parent959274753857efe9c5f1ba35fe727f51e9aa128d (diff)
x86: Clean up current_stack_pointer
There's no good reason for it to be a macro, and x86_64 will want to use it, so it should be in a header. Acked-by: Borislav Petkov <bp@suse.de> Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Diffstat (limited to 'arch/x86/include/asm/thread_info.h')
-rw-r--r--arch/x86/include/asm/thread_info.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index 547e344a6dc6..8b13b0fbda8e 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -170,6 +170,17 @@ static inline struct thread_info *current_thread_info(void)
return ti;
}
+static inline unsigned long current_stack_pointer(void)
+{
+ unsigned long sp;
+#ifdef CONFIG_X86_64
+ asm("mov %%rsp,%0" : "=g" (sp));
+#else
+ asm("mov %%esp,%0" : "=g" (sp));
+#endif
+ return sp;
+}
+
#else /* !__ASSEMBLY__ */
/* how to get the thread information struct from ASM */