[coreboot] __attribute__((stdcall)) vs. __attribute__((regparm(0)))

Segher Boessenkool segher at kernel.crashing.org
Thu Oct 16 18:29:31 CEST 2008


>> There's a warning in the man pages for gcc that says that you have to
>> compile all the functions (including libraries) with the same  
>> setting.

It says that in the description of -mregparm, not of the function
attribute "regparm", and it is slightly misleading: -mregparm
specifies the default for any function without an explicit attribute,
so you better use the same -mregparm option for any file that contains
functions (or calls functions) without explicit attribute; but you _can_
have multiple regparm settings in total.

> biosint is only called from assembly, so it really doesn't matter. The
> issue is that the assembly that calls biosint is written
> with as "regparm=0", from long ago, and the rules got changed when we
> set regparm=3.
>
> Again, only functions called from assembly for vm86 mode need to be
> compiled with regparm=0.

Whatever calling sequence you choose, please put the required attribute
for any function that needs something specific in the declaration for
that function (in a header file).  This includes any function  
implemented
in assembler (except those without arguments at all).

This will save you a lot of headaches ;-)


Segher





More information about the coreboot mailing list