3-12 Vol. 1
BASIC EXECUTION ENVIRONMENT
The special uses of general-purpose registers by instructions are described in Chapter 5, “Instruction Set
Summary,” in this volume. See also: Chapter 3, Chapter 4 and Chapter 5 of Intel® 64 and IA-32 Architectures Soft-
ware Developer’s Manual, Volumes 2A, 2B & 2C. The following is a summary of special uses:
•
EAX — Accumulator for operands and results data
•
EBX — Pointer to data in the DS segment
•
ECX — Counter for string and loop operations
•
EDX — I/O pointer
•
ESI — Pointer to data in the segment pointed to by the DS register; source pointer for string operations
•
EDI — Pointer to data (or destination) in the segment pointed to by the ES register; destination pointer for
string operations
•
ESP — Stack pointer (in the SS segment)
•
EBP — Pointer to data on the stack (in the SS segment)
As shown in Figure 3-5, the lower 16 bits of the general-purpose registers map directly to the register set found in
the 8086 and Intel 286 processors and can be referenced with the names AX, BX, CX, DX, BP, SI, DI, and SP. Each
of the lower two bytes of the EAX, EBX, ECX, and EDX registers can be referenced by the names AH, BH, CH, and
DH (high bytes) and AL, BL, CL, and DL (low bytes).
3.4.1.1
General-Purpose Registers in 64-Bit Mode
In 64-bit mode, there are 16 general purpose registers and the default operand size is 32 bits. However, general-
purpose registers are able to work with either 32-bit or 64-bit operands. If a 32-bit operand size is specified: EAX,
EBX, ECX, EDX, EDI, ESI, EBP, ESP, R8D - R15D are available. If a 64-bit operand size is specified: RAX, RBX, RCX,
RDX, RDI, RSI, RBP, RSP, R8-R15 are available. R8D-R15D/R8-R15 represent eight new general-purpose registers.
All of these registers can be accessed at the byte, word, dword, and qword level. REX prefixes are used to generate
64-bit operand sizes or to reference registers R8-R15.
Registers only available in 64-bit mode (R8-R15 and XMM8-XMM15) are preserved across transitions from 64-bit
mode into compatibility mode then back into 64-bit mode. However, values of R8-R15 and XMM8-XMM15 are unde-
fined after transitions from 64-bit mode through compatibility mode to legacy or real mode and then back through
compatibility mode to 64-bit mode.
Figure 3-5. Alternate General-Purpose Register Names
0
7
15
31
16
8
AH
AL
BH
BL
CH
CL
DH
DL
BP
SI
DI
SP
16-bit
AX
DX
CX
BX
32-bit
EAX
EBX
ECX
EDX
EBP
ESI
ESP
General-Purpose Registers
EDI