提交 6cce16f9 编写于 作者: M Mathias Krause 提交者: H. Peter Anvin

x86, threadinfo: Redo "x86: Use inline assembler to get sp"

This patch restores the changes of commit dff38e3e "x86: Use inline
assembler instead of global register variable to get sp". They got lost
in commit 198d208d "x86: Keep thread_info on thread stack in x86_32"
while moving the code to arch/x86/kernel/irq_32.c.

Quoting Andi from commit dff38e3e:

"""
LTO in gcc 4.6/47. has trouble with global register variables. They were
used to read the stack pointer. Use a simple inline assembler statement
with a mov instead.

This also helps LLVM/clang, which does not support global register
variables.
"""

Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Andi Kleen <ak@linux.intel.com>
Signed-off-by: NMathias Krause <minipli@googlemail.com>
Link: http://lkml.kernel.org/r/1394178752-18047-1-git-send-email-minipli@googlemail.comSigned-off-by: NH. Peter Anvin <hpa@linux.intel.com>
上级 2223f6f6
......@@ -70,7 +70,11 @@ static void call_on_stack(void *func, void *stack)
}
/* how to get the current stack pointer from C */
register unsigned long current_stack_pointer asm("esp") __used;
#define current_stack_pointer ({ \
unsigned long sp; \
asm("mov %%esp,%0" : "=g" (sp)); \
sp; \
})
static inline void *current_stack(void)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册