Calling convention that gets frame pointer register clobbered

Kai Henningsen kaih@khms.westfalen.de
Mon Dec 22 15:22:00 GMT 2003


etienne_lorrain@yahoo.fr (Etienne Lorrain)  wrote on 22.12.03 in <20031222105958.13221.qmail@web11801.mail.yahoo.com>:

> unsigned char
> _EBIOSDISK_getparam (unsigned char disk, ebiosinfo_t *ebiosinfo,
>                      unsigned char *status)
>   {
>   unsigned char carry;
>
>   asm (
> "       int     $0x13           # _EBIOSDISK_getparam   \n"
> "       mov     %%ah,%1                                 \n"
> "       setc    %0                                      \n"
>         : "=qm" (carry), "=qm" (*status), "=S" (*ebiosinfo)
>         : "a"((unsigned short)0x4800), "d" (disk)
>         );
>
>   return carry;
>   }

>   Using output "=m" (*ebiosinfo) and input "S" (ebiosinfo) is not
>  completely equivalent because the output part may generate strange
>  code on some compiler version - but that is the best approximation.

In any case, that's where your error is. You're claiming to move the whole  
structure when actually you're only trying to move the pointer.

Don't lie to the compiler, or the compiler will bite you.

MfG Kai



More information about the Gcc mailing list