Does it exchange %eax and value stored at address%ecxx and store the sum in address%ecx?
The instruction XADD ...
...Exchanges the first operand (destination operand) with the second operand (source operand), then loads the sum of the two values into the destination operand.
So, according to its Operation, it executes the following microcode:
TEMP ← SRC + DEST;
SRC ← DEST;
DEST ← TEMP;
In your case this means that xadd %eax, (%ecx)
EAX plus the value at the address pointed to by ECXECX to EAXECXThis instruction can be combined with a LOCK prefix and hence be executed atomically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With