Instructions

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:

Type Form Operand Value Name
Immediate $Imm Imm Immediate
Register ra R[ra] Register
Memory Imm M[Imm] Absolute
Memory (ra) M[R[ra]] Indirect
Memory Imm(rb) M[Imm+R[rb]] Base + displacement
Memory (rb,ri) M[R[rb]+R[ri]] Indexed
Memory Imm(rb,ri) M[Imm+R[rb]+R[ri]] Indexed
Memory (,ri,s) M[R[ri]s] Scaled indexed
Memory Imm(,ri,s) M[Imm+R[ri]s] Scaled indexed
Memory (rb,ri,s) M[R[rb]+R[ri]s] Scaled indexed
Memory Imm(rb,ri,s) M[Imm+R[rb]+R[ri]s] Scaled indexed
Powered by Forestry.md