411 REFERENCE · Wikibooks
SPARC Assembly/Subroutines
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
This page is going to discuss the use of subroutines in SPARC Assembly.
Saving Registers
Subroutine Linkage
A typical (non-leaf) subroutine has a procedure prologue and epilogue
something like this:Peter Magnusson.
"Understanding stacks and registers in the Sparc architecture(s)".Mark Smotherman.
"SPARC Subroutines".
do_something_useful:
; prologue:
save %sp, -16, %sp
; main body
; ... perform function ...
; leave return value, if any, in register %i0
; epilogue:
ret
restore
Return Values
Further reading