CPU Registers Flashcards
What are the 8 general purpose registers?
EAX, EBX, ECX, EDX, EDI, ESI, EBP, and ESP
What is EAX?
The accumulator register.
- addition subtraction
- store the returned value
What is EBX?
The Base Register.
- catch all for available storage
What is EDX?
The Data Register
It’s often used in mathematical operations like division and multiplication to deal with overflow where the most significant bits would be stored in EDX and the least significant in EAX. It is also commonly used for storing function variables.
What is ESI?
The Source Index
The counterpart to EDI, ESI is often used to store the pointer to a read location. For example, if a function is designed to read a string, ESI would hold the pointer to the location of that string.
What is EDI?
The Destination Index
Though it can be (and is) used for general data storage, EDI was primarily designed to store the storage pointers of functions, such as the write address of a string operation
What is ESP?
The Stack Pointer
ESP is used to track the top of the stack. As items are moved to and from the stack ESP increments/decrements accordingly. Of all of the general purpose registers, ESP is rarely/never used for anything other than it’s intended purpose.
What is EIP?
The Instruction Pointer
Not a general purpose register, but fitting to cover here, EIP points to the memory address of the next instruction to be executed by the CPU. As you’ll see in the coming tutorials, control the value of EIP and you can control the execution flow of the application (to execute code of your choosing).
What is a register?
A register may hold an instruction, a storage address, or any kind of data (such as a bit sequence or individual characters)
What is the stack?
LIFO data structure that lives in RAM. It is an area in program memory that is used for short-term storage of information by the CPU and the program
What are the three groups of registers?
General, Control, and Segment
What are the general registers divided into?
Data registers, Pointer registers, and index registers
What are the four Data registers?
EAX, EBX, ECX, EDX
What are the three Pointer registers?
EIP, ESP, EBP
What are the two index registers?
ESI, EDI