MicroBlaze Processor Reference Guide
153
UG081 (v14.7)
Stack Convention
The architecture for MicroBlaze defines 32 general purpose registers (GPRs). These registers are
classified as volatile, non-volatile, and dedicated.
•
The volatile registers (also known as caller-save) are used as temporaries and do not retain
values across the function calls. Registers R3 through R12 are volatile, of which R3 and R4 are
used for returning values to the caller function, if any. Registers R5 through R10 are used for
passing parameters between subroutines.
•
Registers R19 through R31 retain their contents across function calls and are hence termed as
non-volatile registers (a.k.a callee-save). The callee function is expected to save those non-
volatile registers, which are being used. These are typically saved to the stack during the
prologue and then reloaded during the epilogue.
•
Certain registers are used as dedicated registers and programmers are not expected to use them
for any other purpose.
♦
Registers R14 through R17 are used for storing the return address from interrupts, sub-
routines, traps, and exceptions in that order. Subroutines are called using the branch and
link instruction, which saves the current Program Counter (PC) onto register R15.
♦
Small data area pointers are used for accessing certain memory locations with 16- bit
immediate value. These areas are discussed in the memory model section of this
document. The read only small data area (SDA) anchor R2 (Read-Only) is used to access
the constants such as literals. The other SDA anchor R13 (Read-Write) is used for
accessing the values in the small data read-write section.
♦
Register R1 stores the value of the stack pointer and is updated on entry and exit from
functions.
♦
Register R18 is used as a temporary register for assembler operations.
•
MicroBlaze includes special purpose registers such as: program counter (rpc), machine status
register (rmsr), exception status register (resr), exception address register (rear), floating point
status register (rfsr), branch target register (rbtr), exception data register (redr), memory
management registers (rpid, rzpr, rtlblo, rtlbhi, rtlbx, rtlbsx), and processor version registers
(rpvr0-rpvr12). These registers are not mapped directly to the register file and hence the usage
of these registers is different from the general purpose registers. The value of a special purpose
registers can be transferred to or from a general purpose register by using
mts
and
mfs
instructions respectively.
Stack Convention
The stack conventions used by MicroBlaze are detailed in
The shaded area in
denotes a part of the stack frame for a caller function, while 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.
Содержание MicroBlaze
Страница 1: ...MicroBlaze Processor Reference Guide Embedded Development Kit EDK 14 7 UG081 v14 7...
Страница 4: ...MicroBlaze Processor Reference Guide www xilinx com UG081 v14 7...
Страница 8: ...8 www xilinx com MicroBlaze Processor Reference Guide UG081 v14 7 Chapter 1 Introduction Send Feedback...
Страница 262: ...262 www xilinx com MicroBlaze Processor Reference Guide UG081 v14 7 Send Feedback...