registers
overview
To my understanding, registers are very quickly accessible locations in a CPU, with different architectures having different naming conventions and purposes for each register.
registers
In x86, the big ones to remember are as follows:
| Register | Purpose | Mnemonic |
|---|---|---|
| EAX | Main register used for arithmetic calculations, called the accumulator as it stores the results of arithmetic operations and function return values. | If there's an "A" in the middle then it's for arithmetic. |
| EBX | The base register, points to data in the DS (Data Segment), used to store the base address of a program. | If it's "B" without a "P" then its base address. |
| ECX | Counter register used to hold values that represent the number of times a process is repeated, often used in loop and string operations. | If it's "C" then it counts things. |
| EDX | General purpose register, used for I/O operations and can extend EAX to 64-bits. | "DX" for data extend. |
| ESI | The source index register, stores the address from where to read data. | If it's "S" then its the source pointer. |
| EDI | The destination index register, points to data or a destination in the segment pointed to by the ES (Extra Segment), holds the implied write address to all string operations. | "DI" for destination pointer. |
| EBP | The base pointer, points to data on the stack in the SS (Stack Segment), points to bottom of the current stack frame and is used to reference local variables. | "BP" for base pointer. |
| ESP | The stack pointer points to the top of the current stack frame, and is used to reference local variables. | "SP" for stack pointer. |
It’s also important to remember that each of these registers are 32-bits in length, and can also be broken up into 16-bit registers.