www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Issue 2053] New: PIC & ASM (EBX clobbering)

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2053

           Summary: PIC & ASM (EBX clobbering)
           Product: DGCC aka GDC
           Version: unspecified
          Platform: Macintosh
        OS/Version: Mac OS X
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: glue layer
        AssignedTo: dvdfrdmn users.sf.net
        ReportedBy: fawzi gmx.ch


I am no ams and PIC expert, but I think that the following code
{{{
                    volatile asm
                    {
                        push EDI;
                        lea EDI, newval;
                        mov ESI, [EDI];
                        mov ECX, 4[EDI];
                        lea EDI, equalTo;
                        mov EAX, [EDI];
                        mov EDX, 4[EDI];
                        mov EDI, val;
                        push EBX;
                        xchg EBX, ESI;
                        lock; // lock always needed to make this op atomic
                        cmpxch8b [EDI];
                        setz AL;
                        mov EBX, ESI;
                        pop EBX;
                        pop EDI;
                    }
}}}
should work on x86 when compiled with -fPIC, because EBX is pushed & popped and
no variable or symbol is accessed between push & pop.

The compiler complains about clobbered EBX (from the two xchg EBX and mov EBX
expressions).


-- 
Apr 28 2008
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2053


sean invisibleduck.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED




------- Comment #1 from sean invisibleduck.org  2008-04-28 11:40 -------
Oh I see what you're saying.  Thanks.  I'll make this change.


-- 
Apr 28 2008