Flashcards in CPU Registers Deck (21):
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?
What are control registers used for?
The 32-bit instruction pointer register and the 32-bit flags register combined are considered as the control registers.
Many instructions involve comparisons and mathematical calculations and change the status of the flags and some other conditional instructions test the value of these status flags to take the control flow to other location.
What are segment registers?
Segments are specific areas defined in a program for containing data, code and stack
What are the three main segments ?
Code, Data, Stack
What is the Code Segment?
It contains all the instructions to be executed. A 16-bit Code Segment register or CS register stores the starting address of the code segment
What is the Data Segment?
It contains data, constants and work areas. A 16-bit Data Segment register or DS register stores the starting address of the data segment.