Mail Archives: djgpp/2000/05/06/18:43:41
Thanks, problem solved...I used the stack alternative.
Paul
Dieter Buerssner <buers AT gmx DOT de> wrote in message
news:8f1t7r DOT 3vs63bt DOT 0 AT buerssner-17104 DOT user DOT cis DOT dfn DOT de...
> Paul Crone wrote:
>
> >Please help. I've used the following inline assembly code function in
> >my program using gpp 2.8.1 and all was well. I've just made a new
> >installation on a different PC using gpp 2.9.5.2 and get a compiler
> >error. What have I missed?
>
> There is a change in the handling of inline assembly in recent
> versions of gcc. You are not allowed anymore, to put registers
> in the input-list into the clobber list
>
> >inline void set_vesa_bank_pm(int bank_number)
> >{
> > asm (
> > " call *%0 "
> > : /* no outputs */
> > : "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"
> > );
> >}
>
> On possible (untested) fix, is to use temporary vars like:
>
> /* Assume, the VESA-function does not change ebp */
> int unused1, unused2, unused3;
> asm (" call *%5 "
> : "=b" (unused1), "=d" (unused2), "=a" (unused3)
> : "0" (0), "1" (bank_number), "2" (pm_bank_switcher)
> : "ecx", "esi", "edi" /* all other registers */);
>
> Or you push all the registers yourself onto the stack, call the function,
> and pop the registers again.
>
> /* Untested */
> asm ("pushal; call *%2; popal"
> :
> : "b" (0), "d" (bank_number), "r" (pm_bank_switcher));
>
> --
> Dieter Buerssner
- Raw text -