Registers / General Purpose Registers (GPR)

More of a personal post as I get to grips with Registers / General Purpose Registers (GPR) and start making notes.

The 8 GPR have existed since the 8-bit Intel x86 processor, and they can be viewed using a debugged such as GDB.

After the 16-bit era, the 32-bit era added an e (for extended) and then the 64-bit era changed the e to an r (for register).

geektechstuff_memory_registers_1
Memory Registers

Accumulator register (AX). Used in arithmetic operations.

Was AX in 16-bit, EAX in 32-bit and RAX in 64-bit.

Counter register (CX). Used in shift/rotate instructions and loops.

Was CX in 16-bit, ECX in 32-bit and RCX in 64-bit.

Data register (DX). Used in arithmetic operations and I/O operations.

Was DX in 16-bit, EDX in 32-bit and RDX in 64-bit.

Base register (BX). Used as a pointer to data (located in segment register DS, when in segmented mode).

Was BX in 16-bit, EBX in 32-bit and RBX in 64-bit.

Stack Pointer register (SP). Pointer to the top of the stack.

Was SP in 16-bit, ESP in 32-bit and RSP in 64-bit.

Stack Base Pointer register (BP). Used to point to the base of the stack.

Was BP in 16-bit, EBP in 32-bit and RPB in 64-bit.

Source Index register (SI). Used as a pointer to a source in stream operations.

Was SI in 16-bit, ESI in 32-bit and RSI in 64-bit.

Destination Index register (DI). Used as a pointer to a destination in stream operations.

Was DI in 16-bit, EDI in 32-bit and RDI in 64-bit.

 

AX, CX, DX and BX are mainly used a temporary variables for the CPU (Central Processing Unit) as executes machine instructions. SP, BP, SI, DI are sometimes called pointers as SP / BP store memory addresses (locations), and SI / DI point to where data needs to be read from / to.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.