Re: -mregparm=3

Benjamin C.R. LaHaise (blah@kvack.org)
Wed, 8 Jul 1998 14:11:01 -0400 (EDT)


On Wed, 8 Jul 1998, Andrea Arcangeli wrote:

> >I'm using regparm (using attributes, though) in glibc 2.1 on Intel and
> >it does work. Don't spread these wrong information.

> Also Benjamin are you sure that the bug you have discovered in gcc in the
> nex000 driver is not been fixed in 2.8.1? (probably no if it was a real
> bug and nobody answered you from gcc-bugs...)

Previously I had only tested the code under gcc 2.7.2.x and egcs-1.00.
Now, for the sake of completeness, I just downloaded gcc 2.8.1 and
compiled the code including in my previous message. Here's the relevant
snippet of assembly:

leal 28(%esp),%edx
1-> movl %edi,%eax
2-> movl 8(%ebp),%eax
call *%eax
...
.ident "GCC: (GNU) 2.8.1"

Gcc reuses eax for the function pointer after having loaded it with the
parameter for ei_get_8390_hdr. Hopefully gcc is ok when calling a
specific function. I stand by my claim that -mregparm is currently
unreliable.

> The strange thing is that the kernel crashes also for me but gcc
> -regparm=1 doesn' t print any warning during compilation (even if there
> are some "m" that should be reverted to "r" in the inline asm though).

Iirc, I changed the kernel's asmlinkage definition to add
__attribute__((regparm(0))) to the function definition -- asmlinkage is a
pretty good indication of what actually matters in terms of calling
convention. If you want my old patch (against 2.1.26), you can grab it
from http://www.kvack.org/~blah/patches/blah-2.1.26-4.diff.gz. Howeverm
it's got a lot of other krud in it.

-ben

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu