www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.ide
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript
electronics




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

↑ ↓ ← 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
↑ ↓ → 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