NOTE

1.3 CPU Registers

x86-64 register roles: general-purpose registers, stack/frame pointers, RIP, flags, SIMD registers, and ABI-dependent calling conventions.

Computer Architecture & AssemblyCreated Updated 1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

1. What Is a Register?

A register is a small storage location inside the CPU that instructions can access directly.

Registers hold values currently involved in computation: operands, addresses, counters, return values, stack state, and control information.

2. Why Registers Exist

Register access is far faster than fetching data from main memory. Compilers therefore try to keep frequently used values in registers when possible.

3. x86-64 General-Purpose Registers

x86-64 provides general-purpose registers including:

RAX RBX RCX RDX
RSI RDI RBP RSP
R8  R9  R10 R11
R12 R13 R14 R15

The lower 32/16/8-bit portions can be addressed through names such as eax, ax, or al depending on the register.

RSP

The stack pointer normally identifies the current top of the thread’s stack.

RBP

Historically used as a frame pointer. Optimizing compilers may repurpose it when frame-pointer omission is enabled, so it is not guaranteed to identify every function frame.

4. Instruction Pointer

RIP identifies the current/next instruction position according to architectural execution semantics. Relative addressing based on RIP is common in x86-64 code.

In 64-bit user-space code, traditional segmentation is mostly minimized. FS and GS bases remain useful, especially for thread-local storage and runtime/kernel structures.

6. Calling Conventions

Register roles for function arguments are defined by the ABI, not by x86-64 hardware alone.

For example:

  • System V AMD64 and Windows x64 use different argument-register assignments;
  • Go’s internal ABI has evolved independently.

Therefore, a register being “the first argument register” is platform/ABI-specific.

7. More Registers

Modern x86-64 CPUs also expose:

  • flags/status registers;
  • SIMD/vector registers such as XMM/YMM/ZMM;
  • control/debug registers used by privileged code.

The full register set is much broader than the general-purpose registers most assembly examples begin with.

Loading helpful count