Instructions

As x86-64 is a CISC architecture, it has a vast range of different instructions (about ~980, not counting different operand types for the same instruction), varying in complexity. Below are some of the most commonly used/most important instructions, grouped by functionality. For those interested in a more extensive set of instructions, the official Intel Manual is a nice (and with ~5,000 pages fairly light) read.

Note that a . postfix is a placeholder for a size indicator, so either b(byte), w (word), l (long), or q (quadword). Some instructions allow only a subset of these postfixes.

Mnemonic
Operands
Action

mov.

SRC, DST

DST = SRC

push.

SRC

rsp -= <#bytes>; (rsp) = SRC

pop.

DST

DST = (rsp); rsp += <#bytes>

xchg.

A, B

TMP = A; A = B; B = TMP

movzb.

SRC, DST

DST = SRC (one byte only, higher-order bits set to zero)

movzw.

SRC, DST

DST = SRC (one word only, higher-order bits set to zero)

lea.

A, DST

DST = &A (address of A)


Addressing Modes

The x86-64 architecture allows for many different (memory) addressing modes. Below are some of the most commonly used:

Name
Syntax
Description

Immediate

move the a value 1 into the register rax

Register

move (copy) the contents (8 bytes) from the register rdi into the register rax

Indirect

move 8 bytes from memory starting at the address stored in rdi into the register rax

Base and Displacement

move 8 bytes from memory starting at the address: rdi - 8 into the register rax The displacement may be any positive or negative value.

Base and Index

move 8 bytes from memory starting at the address: rdi + rbx into the register rax

Base, Index, and Scale

move 8 bytes from memory starting at the address: rdi + (rbx * 4) into the register rax

The scale factor may be either 1, 2, 4, or 8.

Base, Index, Scale, and Displacement

move 8 bytes from memory starting at the address: rdi + (rbx * 4) + 16 into the register rax

The displacement may be any positive or negative value.

Note on Order of Operands

For all of these modes, except Immediate, the order of operands given in the example may also be reversed (to use the addressing for the destination instead of the source operand). However, at least one of the operands needs to be a register or intermediate value, so the following would not be a valid instruction:

movq    (%rax), (%rdi)

as both the source and destination operands are memory locations.

Last updated