66 www.xilinx.com MicroBlaze Processor Reference Guide
1-800-255-7778 UG081 (v6.0) June 1, 2006
Chapter 3: MicroBlaze Application Binary Interface
Register Usage Conventions
The register usage convention for MicroBlaze is given in Table 3-2.
The architecture for MicroBlaze defines 32 general purpose registers (GPRs). These
registers are classified as volatile, non-volatile, and dedicated.
The volatile registers (a.k.a 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 sub-routines.
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.
Table 3-2: Register usage conventions
Register Type Enforcement Purpose
R0 Dedicated HW Value 0
R1 Dedicated SW Stack Pointer
R2 Dedicated SW Read-only small data area anchor
R3-R4 Volatile SW Return Values/Temporaries
R5-R10 Volatile SW Passing parameters/Temporaries
R11-R12 Volatile SW Temporaries
R13 Dedicated SW Read-write small data area anchor
R14 Dedicated HW Return address for Interrupt
R15 Dedicated SW Return address for Sub-routine
R16 Dedicated HW Return address for Trap (Debugger)
R17 Dedicated HW,ifconfigured
to support HW
exceptions, else
Return Address for Exceptions
R18 Dedicated SW Reserved for Assembler
R19-R31 Non-volatile SW Must be saved across function calls.
RPC Special HW Program counter
RMSR Special HW Machine Status Register
REAR Special HW Exception Address Register
RESR Special HW Exception Status Register
RFSR Special HW Floating Point Status Register
RBTR Special HW Branch Target Register
Special HW Processor Version Register 0 thru 11