21.3. Registers

The 64-bit x86 register set consists of 16 general purpose registers, only 8 of which are available in 16-bit and 32-bit mode. The core eight 16-bit registers are AX, BX, CX, DX, SI, DI, BP, and SP. The least significant 8 bits of the first four of these registers are accessible via the AL, BL, CL, and DL in all execution modes. In 64-bit mode, the least significant 8 bits of the other four of these registers are also accessible; these are named SIL, DIL, SPL, and BPL. The most significant 8 bits of the first four 16-bit registers are also available, although there are some restrictions on when they can be used in 64-bit mode; these are named AH, BH, CH, and DH.

The 80386 extended these registers to 32 bits while retaining all of the 16-bit and 8-bit names that were available in 16-bit mode. The new extended registers are denoted by adding a E prefix; thus the core eight 32-bit registers are named EAX, EBX, ECX, EDX, ESI, EDI, EBP, and ESP. The original 8-bit and 16-bit register names map into the least significant portion of the 32-bit registers.

64-bit long mode further extended these registers to 64 bits in size by adding a R prefix to the 16-bit name; thus the base eight 64-bit registers are named RAX, RBX, etc. Long mode also added eight extra registers named numerically r8 through r15. The least significant 32 bits of these registers are available via a d suffix (r8d through r15d), the least significant 16 bits via a w suffix (r8w through r15w), and the least significant 8 bits via a b suffix (r8b through r15b).

Figure 21.1 summarizes the full 64-bit x86 general purpose register set.

Figure 21.1. x86 General Purpose Registers

x86 General Purpose Registers