n Preserve saved registers:
SUBI SP,SP,#40 // make room on stack for 5 regs
STUR LR,[SP,#32] // save LR on stack
STUR X22,[SP,#24] // save X22 on stack
STUR X21,[SP,#16] // save X21 on stack
STUR X20,[SP,#8] // save X20 on stack
STUR X19,[SP,#0] // save X19 on stack
MOV X21, X0 // copy parameter X0 into X21
MOV X22, X1 // copy parameter X1 into X22
n Restore saved registers:
exit1: LDUR X19, [SP,#0] // restore X19 from stack
LDUR X20, [SP,#8] // restore X20 from stack
LDUR X21,[SP,#16] // restore X21 from stack
LDUR X22,[SP,#24] // restore X22 from stack
LDUR X30,[SP,#32] // restore LR from stack
SUBI SP,SP,#40 // restore stack pointer
Chapter 2 — Instructions: Language of the Computer — 71
Preserving Registers