Overview
x86-64 instructions are designed so that commonly used instructions and those with fewer operands are encoded in a smaller number of bytes. Instructions range in length from 1 to 15 bytes.
x86-64 assembly comes in two flavors: ATT and Intel. ATT is most common in Linux systems so I focus on that. The most important distinction between the two is operand ordering: Intel syntax lists multiple operands in reverse order compared to ATT.
Instruction Classes
There are three types of operands:
- Immediates. These denote constant values. In ATT assembly, they are written with a
$
followed by an integer using standard C notation. - Registers. These denote the contents of a register.
- Memory. These denote some memory location according to a computed address (i.e. the effective address).
Type | Form | Operand Value | Name |
---|---|---|---|
Immediate | Immediate | ||
Register | Register | ||
Memory | Absolute | ||
Memory | Indirect | ||
Memory | Base + displacement | ||
Memory | Indexed | ||
Memory | Indexed | ||
Memory | Scaled indexed | ||
Memory | Scaled indexed | ||
Memory | Scaled indexed | ||
Memory | Scaled indexed |
Bibliography
- Bryant, Randal E., and David O’Hallaron. Computer Systems: A Programmer’s Perspective. Third edition, Global edition. Always Learning. Pearson, 2016.