وو

وحید آنلاین . آرشیو وبلاگ وحیدمی دات آی آر . شرکت بیان. vahidmy.blog.ir

وو

وحید آنلاین . آرشیو وبلاگ وحیدمی دات آی آر . شرکت بیان. vahidmy.blog.ir

CMPXCHG8B

CMPXCHG8B 

Usage: CMPEXHG8B dest,src                     Modifies flags: ZF

Compares the accumulator (64 bits) with 'dest'. If equal the 'dest' is loaded with 'src', otherwise the accumulator is loaded with 'dest'.

Compare and Exchange Eight Bytes


CMPXCHG8B mem                 ; 0F C7 /1             [PENT]


This is a larger and more unwieldy version of CMPXCHG: it compares the 64-bit (eight-byte) value stored at [mem] with the value in EDX:EAX. If they are equal, it sets the zero flag and stores ECX:EBX into the memory area. If they are unequal, it clears the zero flag and stores the memory contents into EDX:EAX.


CMPXCHG8B can be used with the LOCK prefix, to allow atomic execution. This is useful in multi-processor and multi-tasking environments.


EXAMPLE: 

mov D$Test 15

mov eax 55

mov ecx 20

cmpxchg8b Q$Test     ; eax = 15d > 0Fh