What about __attribute__((regparm(0))) ?

The gcc documentation is not clear on this, but a call made this way
should take all of its arguments from the stack.

Segher: How do regparm(0) and stdcall differ for i386?

"stdcall" means the callee pops the args from the stack when it returns;
"cdecl" (the default) means the caller has to pop them.  "stdcall" gives
smaller code, but cannot work for functions without prototype (you
shouldn't have such anyway, with ISO C -- but in olden days it was the
norm).  If you would like stdcall by default, use -mrtd.

"regparm" says how many integer arguments are passed in registers instead
of on the stack.  0 is the default, and 3 is the maximum.  The registers
used are A, D, C.  Use -mregparm=N to get some other default.

So, "stdcall" and "regparm" are orthogonal.  stdcall would be good for
coreboot (smaller code size), but regparm > 0 probably increases code
size (try it though). Whatever you use, "special" code (context switching,
etc. -- but also all assembler routines in general) need to be aware of
the calling sequence in use, of course -- but they can always override
it to something of their liking.

What is the actual problem you are trying to solve here?


Segher


--
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to