Sunday, June 17, 2018

AMD64/X86_64 General Purpose Registers

The 64 Bit registers consist of 16 general purpose registers, made up of the original 8 registers included in the original 16 and 32 bit CPU and still available in the 16 bit and 32 bit modes.

The original AX, BX, CX and DX registers are further subdivided into high-low pairs AH/AL, BH/BL, CH/CL, DH/DL, however the use of the high portion is not supported by all of the operations, which is indicated by those registers shaded in light grey in the tables below.

The registers are expanded to 64 Bit and are accessed by prefixing the original 16 Bit register names with 'R', as in RAX, RBX, RCX, RDX etc. in addition 8 new general purpose registers have been introduced simply as numbered registers R8..R15. The new registers also provide additional registers used to access the sub elements of the registers by adding B, W, D suffix to the register name to access the least significant 8 bits, 16 bits and 32 bits respectively.

In addition to the expanded registers set R8..R15, new registers SIL, DIL, BPL and SPL have been added in 64 bit mode to provide access to the least significant 8 bits of the RSI, RDI, RBP and RSP registers

The addition of the new registers and the improved uniformity introduced for accessing the sub elements of the registers have made register management much simpler. Code can be made more efficient by using the faster registers to store intermediate data, needing to spill over to slower memory less frequently.