cpu registers and buffer overflow

a processor register is a quickly accessible location available to a computer’s CPU. Registers usually consist of a small amount of fast storage.

at buffer overflow we will use a type of registers called General-purpose registers (GPRs) which can store both data and addresses, i.e., they are combined data/address registers and rarely the register file is unified to include floating point as well.

there are very special registers which we will use at buffer overflow which are EIP, ESP

 

EIP : Instruction Pointer

The EIP register always contains the address of the next instruction to be executed.
You cannot directly access or change the instruction pointer.
However, instructions that control program flow, such as calls, jumps, loops, and interrupts, automatically change the instruction pointer.

ex, when u call a function the current location of the call will be stored at the EIP register to be able to get back to it after function return.

 

ESP : Stack Pointer Register

The ESP register points to the current location within the stack segment.
Pushing a value onto the stack decreases the value of ESP.
Popping from the stack increases the value of ESP.

 

thanks for reading, n’ always keep learning 🙂

 

 

shenno