What is Stack frame?
The area reserved on the stack each time a function is called. It holds the return address, saved registers and local variables and is freed when the function returns.
Field: ISA & Assembly
The area reserved on the stack each time a function is called. It holds the return address, saved registers and local variables and is freed when the function returns.
Field: ISA & Assembly
If it also avoids callee-saved registers, it does not even need a stack frame.
A function that calls no other functions (a leaf function) …Subtracting 16 from sp makes the 16 bytes between the new sp and the old one this function's stack frame, where the return address, saved registers and local variables can be kept.
What is the purpose of executing "addi sp, sp, -16" at the …Line 1 subtracts 16 from sp to allocate a stack frame, line 2 writes the return address ra into it, and line 3 writes the callee-saved s0.
The code above is the start (prologue) of a function. What …Return address Leaf function Stack pointer Addressing mode Application binary interface (ABI) Assembler Branch delay slot Callee-saved register Caller-saved register Calling convention