
20
Chapter 2: Memory Model
AMD 64-Bit Technology
24593—Rev. 3.09—September 2003
Stack Addresses—
PUSH, POP, CALL, RET, IRET, and INT
instructions implicitly use the stack pointer, which contains
the address of the procedure stack. See “Stack Operation”
on page 23 for details about the size of the stack pointer.
String Addresses—
String instructions generate sequential
addresses using the rDI and rSI registers, as described in
“Implicit Uses of GPRs” on page 34.
In 64-bit mode, with no address-size override, the size of
effective-address calculations is 64 bits. An effective-address
calculation uses 64-bit base and index registers and sign-
extends displacements to 64 bits. Due to the flat address space
in 64-bit mode, virtual addresses are equal to effective
addresses. (For an exception to this general rule, see “FS and
GS as Base of Address Calculation” on page 20.)
Long-Mode Zero-Extension of 16-Bit and 32-Bit Addresses.
In long mode,
all 16-bit and 32-bit address calculations are zero-extended to
form 64-bit addresses. Address calculations are first truncated
to the effective-address size of the current mode (64-bit mode or
compatibility mode), as overridden by any address-size prefix.
The result is then zero-extended to the full 64-bit address width.
Because of this, 16-bit and 32-bit applications running in
compatibility mode can access only the low 4GB of the long-
mode virtual-address space. Likewise, a 32-bit address
generated in 64-bit mode can access only the low 4GB of the
long-mode virtual-address space.
Displacements and Immediates.
In general, the maximum size of
address displacements and immediate operands is 32 bits. They
can be 8, 16, or 32 bits in size, depending on the instruction or,
for displacements, the effective address size. In 64-bit mode,
displacements are sign-extended to 64 bits during use, but their
actual size (for value representation) remains a maximum of 32
bits. The same is true for immediates in 64-bit mode, when the
operand size is 64 bits. However, support is provided in 64-bit
mode for some 64-bit displacement and immediate forms of the
MOV instruction.
FS and GS as Base of Address Calculation.
In 64-bit mode, the FS and
GS segment-base registers (unlike the DS, ES, and SS segment-
base registers) can be used as non-zero data-segment base
registers for address calculations, as described in “Segmented
Virtual Memory” in Volume 2. 64-bit mode assumes all other