[fpc-pascal] Cmpxchg

Werner Van Belle werner at yellowcouch.org
Wed Mar 31 16:13:00 CEST 2010


I have been browsing the web somewhat to figure out how I can have
access to a cmpxchg function in freepascal. At the momente I found very
little information. Some references on people arguing that this is
unnecessary. Others that it takes too much time etcetera. In any case: I
_really_ want to have access to a cmpxchg function and tried to find
information on the assembler routines on how to get access to such

I got as far as the following statement, which doesn't compile of course

function cmpxchg(CompareVal, NewVal: Cardinal; var Target: Cardinal):
Cardinal; assembler;
 lock cmpxchg [%eax], %ecx

Now, the problem is twofold:
1. in which registers are the incoming values ?
2. there are syntax errors in this couple of lines and I have no idea
what the proper syntax would be (and the freepascal wiki, has very
little information on the assembler directives themselves).

I will of course be grateful to anybody helping me solve this problem
and send a very nice 'thank you' email  :-) 



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20100331/5f24c720/attachment.sig>

More information about the fpc-pascal mailing list