Commit d0efa0cc authored by Pawel Sikora's avatar Pawel Sikora Committed by Linus Torvalds

[PATCH] x86: optimize stack pointer access (reduce register usage)

Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 81dc6cfd
...@@ -87,7 +87,7 @@ fastcall unsigned int do_IRQ(struct pt_regs *regs) ...@@ -87,7 +87,7 @@ fastcall unsigned int do_IRQ(struct pt_regs *regs)
/* build the stack frame on the IRQ stack */ /* build the stack frame on the IRQ stack */
isp = (u32*) ((char*)irqctx + sizeof(*irqctx)); isp = (u32*) ((char*)irqctx + sizeof(*irqctx));
irqctx->tinfo.task = curctx->tinfo.task; irqctx->tinfo.task = curctx->tinfo.task;
irqctx->tinfo.previous_esp = current_stack_pointer(); irqctx->tinfo.previous_esp = current_stack_pointer;
asm volatile( asm volatile(
" xchgl %%ebx,%%esp \n" " xchgl %%ebx,%%esp \n"
...@@ -168,7 +168,7 @@ asmlinkage void do_softirq(void) ...@@ -168,7 +168,7 @@ asmlinkage void do_softirq(void)
curctx = current_thread_info(); curctx = current_thread_info();
irqctx = softirq_ctx[smp_processor_id()]; irqctx = softirq_ctx[smp_processor_id()];
irqctx->tinfo.task = curctx->task; irqctx->tinfo.task = curctx->task;
irqctx->tinfo.previous_esp = current_stack_pointer(); irqctx->tinfo.previous_esp = current_stack_pointer;
/* build the stack frame on the softirq stack */ /* build the stack frame on the softirq stack */
isp = (u32*) ((char*)irqctx + sizeof(*irqctx)); isp = (u32*) ((char*)irqctx + sizeof(*irqctx));
......
...@@ -92,12 +92,7 @@ static inline struct thread_info *current_thread_info(void) ...@@ -92,12 +92,7 @@ static inline struct thread_info *current_thread_info(void)
} }
/* how to get the current stack pointer from C */ /* how to get the current stack pointer from C */
static inline unsigned long current_stack_pointer(void) register unsigned long current_stack_pointer asm("esp");
{
unsigned long ti;
__asm__("movl %%esp,%0; ":"=r" (ti) : );
return ti;
}
/* thread information allocation */ /* thread information allocation */
#ifdef CONFIG_DEBUG_STACK_USAGE #ifdef CONFIG_DEBUG_STACK_USAGE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment