








Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!









… int mult(x, y) prod = mult (a, b) … … return (x * y)
int func(int a, int b) { return (a + b); }
int func2(int a, int b) { return func(b , a); }
main { … func2(5,6); … }
stack pointer
main … … bl func … func2 … … bl func … ?? … func … … ??
Describe the stack and LR contents
Rules about who gets to use/save which registers
Dedicated: r1, r2, r
FuncX: mflr r0 ; Get Link register
stwu r1, -88(r1) ; Save Back chain and move SP stw r0, 92(r1) ; Save Link register stmw r28, 72(r1) ; Save 4 non-volatiles r28-r
Entry Code (prologue)
lwz r0, 92(r1) ; Get saved Link register mtlr r0 ; Restore Link register lmw r28, 72(r1) ; Restore non-volatiles addi r1, r1, 88 ; Remove frame from stack blr ; Return to calling function
Exit Code (epilogue)