Register
Name
Used by
Compiler
Callee
Saved
(41)
Normal Usage
r24
et
Exception temporary
r25
bt
Break temporary
r26
gp
v
Global pointer
r27
sp
v
Stack pointer
r28
fp
v
(44)
Frame pointer
r29
ea
Exception return address
r30
ba
• Normal register set: Break return address
• Shadow register sets:
SSTATUS
register
r31
ra
v
Return address
The endianness of values greater than 8 bits is little endian. The upper 8 bits of a
value are stored at the higher byte address.
Related Information
•
Frame Pointer Elimination
on page 149
•
Programming Model
on page 36
7.4. Stacks
The stack grows downward (i.e. towards lower addresses). The stack pointer points to
the last used slot. The frame pointer points to the saved frame pointer near the top of
the stack frame.
The figure below shows an example of the structure of a current frame. In this case,
function
a()
calls function
b()
, and the stack is shown before the call and after the
prologue in the called function has completed.
(41)
A function can use one of these registers if it saves it first. The function must restore the
register’s original value before exiting.
(43)
In the GNU Linux operating system,
r23
is used as the thread pointer. Otherwise, it is
available as a callee-saved general-purpose register.
(44)
If the frame pointer is not used, the register is available as a callee-saved temporary register.
Refer to “Frame Pointer Elimination” .
7. Application Binary Interface
NII-PRG | 2018.04.18
Nios II Processor Reference Guide
148