From: "Paul Crone" Newsgroups: comp.os.msdos.djgpp Subject: Re: inline asm problem Date: Sat, 6 May 2000 23:37:26 +0100 Organization: GXSN Lines: 53 Message-ID: <8f26ln$htd$1@gxsn.com> References: <007f01bfb76e$0020d320$2f5293c3 AT pkcrone> <8f1t7r DOT 3vs63bt DOT 0 AT buerssner-17104 DOT user DOT cis DOT dfn DOT de> NNTP-Posting-Host: 195.147.91.95 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: 957652471 1NNUCNF1G5B5FC393C gxsn.com X-Complaints-To: abuse AT gxsn DOT com X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Thanks, problem solved...I used the stack alternative. Paul Dieter Buerssner 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