Stack in Memory and Registers
Learn how to implement a stack, call a stack, and use jumps in memory and registers.
We'll cover the following
Register review
We know the following general-purpose CPU registers:
%RAX
(among its specific uses is to contain function return values)%RBX
%RCX
%RDX
We also have special purpose registers:
%RIP
(Instruction Pointer)%RSP
(Stack Pointer)
AMD64 and Intel EM64T architectures introduced additional general-purpose registers—%R8
, %R9
, %R10
, %R11
, %R12
, %R13
, %R14
, %R15
.
These additional registers are used a lot in x code. More general-purpose registers allow faster code execution because temporary computation results can be stored there instead of in-memory locations. Here is a disassembly of the read
function:
(gdb) disass read
The dump of the read
function is given below:
Get hands-on with 1400+ tech skills courses.