Calling sequence and stack frame

Stack pointer always kept 64-bit aligned, and it grows upward.
  previous stack frame
  reg save
  local vars
-4*(N+9)(r30) arg word N (opt)
-52(r30) arg word 4 (optional)
-48(r30) arg word 3 (required)
-44(r30) arg word 2 (required)
-40(r30) arg word 1 (required)
-36(r30) arg word 0 (required)
-32(r30) External Data/LT ptr
-28(r30) External SR4/LT
-24(r30) External RP
-20(r30) Current RP
-16(r30) Static Link
-12(r30) Cleanup
-8(r30) Reloc stub RP
-4(r30) ptr to callee's stack

Clint Whaley 2012-07-10