User Guide
Memory Model 19
24592—Rev. 3.15—November 2009 AMD64 Technology
RIP-relative addressing. The effect of the a ddress-size prefix is to truncate and zero-extend the
computed effective address to 32 bits, like any other addressing mode.
Encoding. For details on instruction encoding of RIP-relative addressing, see in “RIP-Relative
Addressing” in Volume 3.
2.3 Pointers
Pointers are variables that contain a ddresses rather than data. They are used by instructions to
reference memory. Instructions access data using near and far pointers. Stack pointers locate the
current stack.
2.3.1 Near and Far Pointers
Near pointers contain only an effective address, which is used as an offset into the current segment. Far
pointers contain both an effective address and a segment selector that specifies one of several
segments. Figure 2-8 illustrates the two types of pointers.
Figure 2-8. Near and Far Pointers
In 64-bit mode, the AMD64 architecture supports only the flat-memory model in which there is only
one data segment, so the effective address is used as the virtual (linear) address and far pointers are not
needed. In compatibility mode and legacy protected mode, the AMD64 architecture supports multiple
memory segments, so effective addresses can be combined with segment selectors to form far pointers,
and the terms logical address (segment selector and effective address) and far pointer are synonyms.
Near pointers can also be used in compatibility mode and legacy mode.
2.4 Stack Operation
A stack is a portion of a stack segment in memory that is used to link procedures. Software conventions
typically define stacks using a stack frame, which consists of two registers—a stack-frame base
pointer (rBP) and a stack pointer (rSP)—as shown in Figure 2-9 on page 20. These stack pointers can
be either near pointers or far pointers.
The stack-segment (SS) register, points to the base address of the current stack segment. The stack
pointers contain offsets from the base address of the current stack segment. All instructions that
address memory using the rBP or rSP registers cause the processor to access the current stack segment.
513-109.eps
Far PointerNear Pointer
Effective Address (EA) Effective Address (EA)Selector