delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/06/10:15:44

Message-ID: <007f01bfb76e$0020d320$2f5293c3@pkcrone>
From: "Paul Crone" <paul AT pkcrone DOT globalnet DOT co DOT uk>
To: <djgpp AT delorie DOT com>
Subject: inline asm problem
Date: Sat, 6 May 2000 16:14:57 +0100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Reply-To: djgpp AT delorie DOT com

This is a multi-part message in MIME format.

------=_NextPart_000_0074_01BFB776.38830DC0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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?

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"
   );
}


Errors reported against 3rd line of code segment:
"Invalid 'asm' statement"
"fixed or forbidden register 1 (dx) was spilled for class DREG"

Is it an installation problem or a coding problem?

Thanks
Paul



------=_NextPart_000_0074_01BFB776.38830DC0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>Please help.&nbsp; I've used the following inline =
assembly=20
code function in my<BR>program using gpp 2.8.1 and all was well.&nbsp; =
I've just=20
made a new installation<BR>on a different PC using gpp 2.9.5.2 and get a =

compiler error.&nbsp; What have I<BR>missed?<BR><BR>inline void=20
set_vesa_bank_pm(int bank_number)<BR>{<BR>&nbsp;&nbsp; asm =
(<BR>&nbsp;&nbsp; "=20
call *%0 "<BR>&nbsp;&nbsp;&nbsp;=20
:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;=20
/* no outputs */<BR>&nbsp;&nbsp;&nbsp; : "r"=20
(pm_bank_switcher),&nbsp;&nbsp;&nbsp;&nbsp; /* function pointer in any =
register=20
*/<BR>&nbsp;&nbsp; "b"=20
(0),&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
/* set %ebx to zero */<BR>&nbsp;&nbsp; "d"=20
(bank_number)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 /*=20
bank number in %edx */<BR><BR>&nbsp;&nbsp;&nbsp; :=20
"%eax",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
/* clobber list (we have no way of */<BR>&nbsp;&nbsp;=20
"%ebx",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
/* knowing which registers the VESA */<BR>&nbsp;&nbsp;=20
"%ecx",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
/* code is going to change, so we */<BR>&nbsp;&nbsp;=20
"%edx",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
/* have to assume the worst and list */<BR>&nbsp;&nbsp;=20
"%esi",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
/* them all here) */<BR>&nbsp;&nbsp; "%edi"<BR>&nbsp;&nbsp;=20
);<BR>}<BR><BR><BR>Errors reported against 3rd line of code =
segment:<BR>"Invalid=20
'asm' statement"<BR>"fixed or forbidden register 1 (dx) was spilled for =
class=20
DREG"<BR><BR>Is it an installation problem or a coding=20
problem?<BR><BR>Thanks<BR>Paul<BR><BR></FONT></DIV></BODY></HTML>

------=_NextPart_000_0074_01BFB776.38830DC0--

- Raw text -


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