www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/27/18:15:55

From: "Michael Stewart" <mike AT reggin DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
References: <39572abe AT news DOT server DOT worldonline DOT co DOT uk> <mu8fls4jvsdvmtm8cchbr8vaoreafrlke6 AT 4ax DOT com>
Subject: Re: ASM help
Lines: 49
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2014.211
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
X-Original-NNTP-Posting-Host: 212.188.138.55
Message-ID: <395918cd@news.server.worldonline.co.uk>
Date: Tue, 27 Jun 2000 22:16:17 +0100
NNTP-Posting-Host: 212.49.224.15
X-Trace: server12-lon1.london1.l3.net 962140366 212.49.224.15 (Tue, 27 Jun 2000 22:12:46 BST)
NNTP-Posting-Date: Tue, 27 Jun 2000 22:12:46 BST
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

> >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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019