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).
Comment #1 by sean — 2008-04-28T11:40:09Z
Oh I see what you're saying. Thanks. I'll make this change.
Comment #2 by ibuclaw — 2012-07-06T05:23:02Z
D Inline Assembler support in GDC has been yanked out. So this report is no longer valid.