Mail Archives: djgpp/2000/06/27/18:15:55
> >I know practically nothing about ASM, so this error is annoying me
somewhat.
> >This bit of code is from the User Guide annd was written by Shawn
> >Hargreaves. Anyone know how to fix this error?
> >
<snip>
> >Error: Invalid `asm' statement:
> >Error: fixed or forbidden register 1 (dx) was spilled for class DREG.
>
> Under newer versions of binutils, input registers can't be labeled as
> clobbered. I can see two options (asm gurus please help me on this):
> o save and restore all regs around the VESA call
> o mark clobbered input registers as dummy output registers
This compiles now without error, but I have yet to test it.
void set_bank (int bank_number) {
int tmp;
asm (
" call *%0 "
: "r=" (tmp), // Clobbered regs as dummy output
"b=" (tmp), // registers
"d=" (tmp)
: "r" (pm_bank_switcher), // function pointer in any register
"b" (0), // set %ebx to zero
"d" (bank_number) // bank number in %edx
: "%eax", // clobber list (we have no way of
"%ebx", // knowing which registers the VESA
"%ecx", // code is going to change, so we
"%edx", // have to assume the worst and list
"%esi", // them all here)
"%edi"
);
}
> Look at newer versions of Allegro (3.12 or 3.9.x) to see how they
> accomplish this.
I have 3.12 installed and it has all this in an asm file.
Thanks
Mike
- Raw text -