stack frame setup

Stack frame
local var
saved sp
return pc


  • Caller: pass parameters with registers / stack

  • Caller: save return PC on stack

  • Transfer ctrl from Caller to Callee

  • Callee: Save the old Stack pointer (SP)

  • Callee: Allocate space for local vars of callee on stack

  • Callee: Adjust SP to point to new stack top

When finished, just restore SP!