delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/03/15/15:04:50

Date: Tue, 15 Mar 94 20:07:13 +0100
From: buers AT dg1 DOT chemie DOT uni-konstanz DOT de (Dieter Buerssner)
To: cnc AT netcom DOT com
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: gcc extended asm bug?

Hello Christopher,

I beleive the solution to your problem might be very easy (I haven't tried
it though).

   cnc AT netcom DOT com (Christopher Christensen):
   I'm running into a problem with the extended asm feature of DJGPP...
   GCC seems to be ignoring the list of clobbered registers for some
   reason.  The generated code isn't doing anything to preserve registers
   like %esi, %edi, and %ebx which need to be preserved.
   Here's an example:

   --- foo.c ---

   void foo()
   {
   asm(
    "movl $0,%%edi
     movl $0,%%esi
     movl $0,%%ebx"
   :: "b" (5), "S" (10)               /* list of inputs */
   : "%%ebx", "%%esi", "%%edi", "cc"  /* list of clobbered registers */
   );
   }

I similar situations I wrote the list of clobbered registers without the
percent signs: " ... :: ... : "ebx", "esi", "edi" ); ". In my cases 
all the three register would be saved. I don't know what "cc" in your list of
clobbered registers means. I also don't understand your list of inputs:
I would write the whole example as

void foo(void)
{
  asm("movl $0, %%edi\n"
      "movl $0, %%esi\n"
      "movl $0, %%ebi\n" ::: "esi", "edi", "ebx");
}

Hope this helps
    Dieter





- Raw text -


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