MOV
By Vesper Vei
1 minute read
Table of Contents
MOV
MOV (mov)
Basic purpose
The MOV instruction is used to copy the value of the source operand to the destination operand.
This is one of the most commonly used instructions for data transfer.
Instruction format
mov dst, srcdst = srcAllowed:
- Register ← Register
- Register ← Memory
- Memory ← Register
- Register ← Immediate
- Memory ← Immediate Forbidden:
- Memory ← Memory
Behavioral characteristics
- Different alignment and size selections may trigger automatic extension (such as movzx, movsx)
- Does not modify EFLAGS (important)
- Can perform zero extension (
mov r32→ automatically clears the upper 32 bits)
Example:
mov eax, [rbp-0x10]mov [rbp-0x8], raxmov ecx, 0x1234Equivalent analysis
MOV is a pure data copy operation and can be regarded as:
dst = srcUnderstanding MOV is very helpful for mastering function argument passing and register behavior under the ABI.
Common uses
- Passing variables
- Initializing registers
- Changing pointer positions
- Saving and restoring values