How to understand CMPXCHG compare and exchange operation instructions
This article introduces you how to understand CMPXCHG comparison and exchange operation instructions, the content is very detailed, interested friends can refer to, hope to be helpful to you.
Instruction mnemonic CMPXCHG
Meaning: compare and exchange instructions
Usage: compare destination operands with cumulative operands (AH, AL, EAX). If equal (ZF=1), copy the source Operand to the destination Operand, otherwise copy the destination Operand to the accumulator.
Instruction format:
CMPXCHG reg regCMPXCHG mem reg
Examples are as follows:
CMPXCHG CX,DX1. Before the instruction execution: (AX) = 00FFH, (CX) = 00FFH, (DX) = 00EFH; after the instruction execution: (AX) = 00FFH, (CX) = 00EFH, (DX) = 00EFH. Before instruction execution: (AX) = 00EEH, (CX) = 00FFH, (DX) = 00EFH; after instruction execution: (AX) = 00FFH, (CX) = 00EFH, (DX) = 00EFH
Detailed description of the flow chart:
On how to understand CMPXCHG comparison and exchange instructions to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.