delorie.com/archives/browse.cgi | search |
From: | "lewi9908" <lewi9908 AT ghc DOT ctc DOT edu> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Quest about inline asm... |
Date: | Thu, 12 Dec 2002 11:56:21 -0800 |
Organization: | Posted via Supernews, http://www.supernews.com |
Message-ID: | <uvhqfmcgbgs2f2@corp.supernews.com> |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 6.00.2600.0000 |
X-MimeOLE: | Produced By Microsoft MimeOLE V6.00.2600.0000 |
X-Complaints-To: | abuse AT supernews DOT com |
Lines: | 71 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
Hi I am trying to convert Borand C++ codes to DJGPP cause I need PMode for OS but OS dev technology is not needed for this problem so enough of that I had all the asm I needed as inline asm in the Borland C++ codes. I decided when moving to DJGPP that I will use external asm files with asm coded like C style functions. But I now come to the code below that is shorten. Rather than change the C code below to asm I decided to use DJGPP inline asm becasue it is just two asm instructions push and pop... Now the code below the 1st loop loops till break is hit which has been shorten and ResultsMod is push on to the stack. Then a counter PushCount keeps track of each push so the 2nd for will pop the stack to ValueToUse the amount of times the value of PushCount... Both the Borland C++(commented) and DJGPP(uncommented) inline asm are in place in the code below... void funt() { int PushCount = 0; ... for(;;) { int ResultsMod; ... //Set ResultsMod... //Old borland inline asm /*asm { push ResultsMod }*/ //New GCC inline asm... __asm__("pushl %eax" : /*No output*/ :"a"(ResultsMod) :"%eax"); ... } ... for(...) { int ValueToUse; //Don't Set ValueToUse yet... //Old borland inline asm /*asm { pop ValueToUse }*/ //GCC inline asm... __asm__("popl %eax" :"=a"(ValueToUse) :/*No input*/ :"%eax"); ... } } For a direct question what am I doing wrong with the Borland C++ inline asm(push/pop) to DJGPP inline asm to get the error below twice... ... : Invalid 'asm' statement: ... : fixed or forbidden register 0 (ax) was spilled for class AREG. Any help...
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |