Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 1.96 KB

File metadata and controls

34 lines (25 loc) · 1.96 KB

x86-64 Integer Registers

Registers
Registers are areas in the CPU where data can be processed. CPUs don’t operate on memory directly, but instead data is loaded into registers, processed, and written back to memory. In assembly language, generally, you cannot directly copy data from one memory location to another without first passing that data through a register.

 Alt text

To recap:

  • bytes - 8-bit data
  • words - 16-bit data
  • doublewords - 32-bit data
  • quadwords - 64-bit data
  • double quadwords - 128-bit data

The bold characters will be important later.

General Purpose Registers
The first type of register is what is known as a General Purpose Register (GPR). GPRs are referred to as general purpose because they can contain either data, in this case up to a 64-bit value, or a memory address (a pointer). A value in a GPR can be processed through operations like addition, multiplication, shifting, etc.

AT&T Syntax:

  • %rax, %rcx, %rdx, %rbx, %rsi, %rdi - 64bit quad word
  • %eax, %ecx, %edx, %ebx, %esi, %edi - 32bit double word (the lower half of the %rax, %rcx etc. -registers).
  • %r8 through %r15

Special Registers

  • %rip - Instruction pointer
  • %rsp - Stack Pointer
  • %rflags - Flags register (Carry, zero, sign, etc..)

External References