🏳️
The CTF Recipes
  • Introduction
  • Cryptography
    • Introduction
    • General knowledge
      • Encoding
        • Character encoding
          • ASCII
          • Unicode
          • UTF-8
        • Data encoding
          • Base16
          • Base32
          • Base64
      • Maths
        • Modular arithmetic
          • Greatest Common Divisor
          • Fermat's little theorem
          • Quadratic residues
          • Tonelli-Shanks
          • Chinese Remainder Theorem
          • Modular binomial
      • Padding
        • PKCS#7
    • Misc
      • XOR
    • Mono-alphabetic substitution
      • Index of coincidence
      • frequency analysis
      • Well known algorithms
        • 🔴Scytale
        • 🔴ROT
        • 🔴Polybe
        • 🔴Vigenere
        • 🔴Pigpen cipher
        • 🔴Affine cipher
    • Symmetric Cryptography
      • AES
        • Block Encryption procedure
          • Byte Substitution
          • Shift Row
          • Mix Column
          • Add Key
          • Key Expansion / Key Schedule
        • Mode of Operation
          • ECB
            • Block shuffling
              • Challenge example
            • ECB Oracle
              • Challenge example
          • CBC
            • Bit flipping
              • Challenge example
            • Padding oracle
              • Challenge example
          • OFB
            • Key stream reconstruction
            • Encrypt to Uncrypt
  • 🛠️Pwn
    • General knowledge
      • STACK
        • Variables storage
        • Stack frame
      • PLT and GOT
      • HEAP
        • HEAP operations
        • Chunk
        • Bins
        • Chunk allocation and reallocation
      • Syscall
    • Architectures
      • aarch32
        • Registers
        • Instruction set
        • Calling convention
      • aarch64
        • Registers
        • Instruction set
        • Calling convention
      • mips32
        • Registers
        • Instruction set
        • Calling convention
      • mips64
        • Registers
        • Instruction set
        • Calling convention
      • x86 / x64
        • Registers
        • Instruction set
        • Calling convention
    • Stack exploitation
      • Stack Buffer Overflow
        • Dangerous functions
          • gets
          • memcpy
          • sprintf
          • strcat
          • strcpy
        • Basics
          • Challenge example
        • Instruction pointer Overwrite
          • Challenge example
        • De Bruijn Sequences
        • Stack reading
          • Challenge example
      • Format string
        • Dangerous functions
          • printf
          • fprintf
        • Placeholder
        • Data Leak
          • Challenge example
        • Data modification
          • Challenge example
      • Arbitrary code execution
        • Shellcode
        • ret2reg
        • Code reuse attack
          • Ret2plt
          • Ret2dlresolve
          • GOT Overwrite
          • Ret2LibC
          • Leaking LibC
          • Ret2csu
          • Return Oriented Programming - ROP
          • Sigreturn Oriented Programming - SROP
          • Blind Return Oriented Programming - BROP
            • Challenge example
          • 🔴Call Oriented Programming - COP
          • 🔴Jump Oriented Programming - JOP
          • One gadget
        • Stack pivoting
    • 🛠️Heap exploitation
      • Heap overflow
        • Challenge example
      • Use after free
        • Challenge example
      • 🛠️Double free
      • 🔴Unlink exploit
    • Protections
      • Stack Canaries
      • No eXecute
      • PIE
      • ASLR
      • RELRO
    • Integer overflow
Powered by GitBook
On this page
  1. Pwn
  2. Architectures
  3. x86 / x64

Registers

Main x86 and x64 registers

There is 8 General Purpose Registers (GPRs) in x86 and x64 architectures.

x86
x64
name
Usage

EAX

RAX

Accumulator

Store the results of arithmetic and logical operations

EBX

RBX

Base

Store the base address of memory operands

ECX

RCX

Counter

Store the count of iterative instructions

EDX

RDX

Data

Store the results of multiplication and division operations

ESP

RSP

Stack Pointer

Store the stack pointer

EBP

RBP

Base Pointer

Store the base pointer

ESI

RSI

Source Index

Store the source index for string operations

EDI

RDI

Destination Index

Store the destination index for string operations

Two groups are distinguished :

  • EAX/RAX, EBX/RBX, ECX/RCX and EDX/RDX have to store temporary data for the processor.

  • ESP/RSP, EBP/RBP, ESI/RSI and EDI/RDI are instead used as pointers and indexes

There is three other main registers :

x86
x64
Name
Usage

EFLAGS

RFLAGS

Flags

Store the current state of the CPU's flags, which are special bits that are used to control the execution of instructions

EIP

RIP

Instruction Pointer

Store the current instruction pointer, which is the address of the next instruction to be executed by the CPU. The instruction pointer is automatically updated by the CPU as instructions are executed, and it is used to determine the order in which instructions are executed

CS

CS

Code Segment

Store the code segment selector, which is a value that specifies the current segment of memory that is being used to store the instructions that are executed by the CPU

There is other registers like the segment registers (DS, ES, FS, GS, and SS), the control registers (CR0, CR1, CR2, CR3, and CR4), and the debug registers (DR0, DR1, DR2, DR3, DR4, DR5, DR6, and DR7). However, this is not a complete list, and there may be other registers that are available on some 32-bit x86 CPUs.

Previousx86 / x64NextInstruction set

Last updated 2 years ago

🛠️