Prolog and epilog
On entry to a procedure, you might have to do some or all of the following
steps:
- Save the link register.
- If you use any of the CR bits 8-23 (CR2, CR3, CR4, CR5), save the CR.
- Save any nonvolatile FPRs that are used by this procedure in the FPR save area.
- Save all nonvolatile VPRs that are used by this procedure
in the callers VPR save area.
- Save the VRSAVE register
- Save all nonvolatile GPRs that are used by this procedure in the GPR save area.
- Store back chain and decrement stack pointer by the size of the stack
frame. Note that if a stack overflow occurs, it will be known immediately
when the store of the back chain is done.
On exit from a procedure, you might have to perform some or all of the
following steps:
- Restore all GPRs saved.
- Restore all VPRs saved
- Restore the VRSAVE register
- Restore stack pointer to the value it had on entry.
- Restore link register if necessary.
- Restore bits 8-23 of the CR if necessary.
- If you saved any FPRs, restore them.
- Return to caller.