Assembly Flashcards
EAX
Extended Accumulator Register
EBX
Extended Base Register
ECD
Extended Counter Register
EDX
Extended Data Register
ESI
Extended Source Index
EDI
Extended Destination Index
EBP
Extended Base Pointer
ESP
Extended Stack Pointer
Z flag
Zero Flag, set when the result of the last operation is zero.
S flag
Signed Flag, set to determine if values should be intercepted as as signed or unsigned.
O flag
Overflow Flag, set when the result of the last operation switches the most significant bit from either F to 0 or 0 to F.
C flag
Carry Flag, set when the result of the last operation changes the most significant bit.
EIP
Extended Instruction Pointer:
Points to the next instruction to be executed.
.text
Where program code is stored.
.data
Where global data is stored.
.stack
Where local variable and function arguments are stored.
.heap
Extendable memory segment that programs can use whenever they need more memory space.
Stack
Stores local variables and function arguments.
Organized as a “Last in First out” data structure. When something is added to it, it is added to the top and when something is removed, it is removed from the top. It grows backwards, from the highest memory address to the lowest.
ESP points to the top, which is done by decrementing ESP (because it grows backwards from highest address to the lowest).
Stack Frames
Every process has at least one thread, and every thread has its own stack. And within the stack of every thread, each function has its own stack frame.
The base is the beginning of a stack frame.
The main function in every program has its stack, when it calls a function the called function creates its own stack frame which is marked out by the EBP that points to the beginning of the functions stack frame and the ESP that points to the top of the stack.
Heap
Memory space that can be allocated by a process when it needs more memory.
Each process has one heap and it is shared among the different threads. All the threads share the same heap.
It is a linked-list data structure, and when the process doesn’t need the memory anymore, it frees the allocated heap, by de-referencing the position.