Re: RFC: avoid asmlinkage on x86 traps/interrupts

From: Andrea Arcangeli
Date: Wed Nov 03 2004 - 04:46:26 EST


On Tue, Nov 02, 2004 at 12:56:54PM -0800, Linus Torvalds wrote:
> if (curctx != irqctx) {
> + int arg1, arg2, ebx;
> +
> /* build the stack frame on the IRQ stack */
> isp = (u32*) ((char*)irqctx + sizeof(*irqctx));
> irqctx->tinfo.task = curctx->tinfo.task;
> irqctx->tinfo.previous_esp = current_stack_pointer();
>
> - *--isp = (u32) &regs;
> - *--isp = (u32) irq;
> -
> asm volatile(
> " xchgl %%ebx,%%esp \n"
> " call __do_IRQ \n"
> - " xchgl %%ebx,%%esp \n"
> - : : "b"(isp)
> - : "memory", "cc", "eax", "edx", "ecx"
> + " movl %%ebx,%%esp \n"
> + : "=a" (arg1), "=d" (arg2), "=b" (ebx)
> + : "0" (irq), "1" (regs), "2" (isp)
> + : "memory", "cc", "ecx"
> );

why do you restore the parameters into arg1/arg2/ebx? since it's
volatile I doubt gcc can optimize them away despite they're clearly
going to be discarded.

I guess it'd be nicer to simply move the output into the input with "a",
"d", "b", and the not add any output at all, and put "eax/edx" back into
the clobbers.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/