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

Myles Watson mylesgw at gmail.com
Thu Oct 16 18:37:30 CEST 2008



> -----Original Message-----
> From: Segher Boessenkool [mailto:segher at kernel.crashing.org]
> Sent: Thursday, October 16, 2008 10:30 AM
> To: ron minnich
> Cc: Myles Watson; Carl-Daniel Hailfinger; Coreboot
> Subject: Re: [coreboot] __attribute__((stdcall)) vs.
> __attribute__((regparm(0)))
> 
> >> 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 ;-)

I appreciate the clarification.

Thanks,
Myles





More information about the coreboot mailing list