Re: [RFC PATCH (take #2)] i386: kill CONFIG_REGPARM completely

From: H. Peter Anvin
Date: Wed May 24 2006 - 16:36:12 EST


Followup to: <Pine.LNX.4.61.0605220739580.26623@xxxxxxxxxxxxxxxxxx>
By author: "linux-os \(Dick Johnson\)" <linux-os@xxxxxxxxxxxx>
In newsgroup: linux.dev.kernel
>
> On ix86 there are not enough registers to pass a significant parameter
> list all in registers! Like when you are printk()ing a dotted-quad IP
> address, etc. Registers ESI, EDI, and EBX are precious, that leaves
> EAX, ECX, EDX and possibly EBP for only 4 parameters. You need 5
> for the dotted quad IP address. If the compiler were to use the
> precious registers, the contents need to be saved on the stack.
> That negates any advantage to passing parameters in registers.
>
> This means that REGPARM will always remain a "hint" to the compiler,
> not some absolute order.
>

Bullshit.

-mregparm=N is an absolute order. On i386 it has the semantics of
passing the first N dword-sized non-varadic arguments in registers
%eax, %edx, and %ecx (in that order). The rest are passed on the
stack; that is true for any ABI.

printk() is varadic; the only argument which will be put in a register
is the formatting string (which goes into %eax).

-hpa


-
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/