previous | start | next

IA32 Function Calls: Stack Frames

Recall: A stack frame is a block of memory allocated on top of the call stack for a function execution.

A stack frame contains:

  1. Information necessary to restore the stack frame of the calling function
  2. Space for those function local variables that must be allocated address in memory.
  3. Saved values of any of the "callee save" registers (%ebx, %esi, %edi) that the function uses.

When the function returns, the function must execute code that will

  1. restore the values of any "callee save" registers
  2. pop its own stack frame off the stack, and
  3. jump to the instruction in the calling function just after the function call


previous | start | next