Stack Convention
The stack conventions used by MicroBlaze are detailed in
The shaded area in
the unshaded area indicates the callee frame function. The ABI conventions of the stack
frame define the protocol for passing parameters, preserving non-volatile register values,
and allocating space for the local variables in a function.
Functions that contain calls to other subroutines are called as non-leaf functions. These
non-leaf functions have to create a new stack frame area for its own use. When the program
starts executing, the stack pointer has the maximum value. As functions are called, the stack
pointer is decremented by the number of words required by every function for its stack
frame. The stack pointer of a caller function always has a higher value as compared to the
callee function.
Table 4-3: Stack Convention
High Address
Old Stack
Pointer
New Stack
Pointer
Low Address
Consider an example where Func1 calls Func2, which in turn calls Func3. The stack
representation at different instances is depicted in
Func 2, the value of the stack pointer (SP) is decremented. This value of SP is again
decremented to accommodate the stack frame for Func3. On return from Func 3 the value
of the stack pointer is increased to its original value in the function, Func 2.
MicroBlaze Processor Reference Guide
UG984 (v2018.2) June 21, 2018
Table 4-3
denotes a part of the stack frame for a caller function, while
Function Parameters for called sub-routine (Arg n .. Arg1)
(Optional: Maximum number of arguments required for any
called procedure from the current procedure).
Link Register (R15)
Callee Saved Register (R31....R19)
(Optional: Only those registers which are used by the
current procedure are saved)
Local Variables for Current Procedure
(Optional: Present only if Locals defined in the procedure)
Functional Parameters (Arg n .. Arg 1)
(Optional: Maximum number of arguments required for any
called procedure from the current procedure)
Link Register
www.xilinx.com
Chapter 4: MicroBlaze Application Binary Interface
Table
4-3.
Table
4-1. After the call from Func 1 to
189
Send Feedback
Need help?
Do you have a question about the MicroBlaze and is the answer not in the manual?