previous | start | next

Stack Frames and the Call Stack and Registers

The registers %ebp and %esp are used to hold the addresses of the bottom and the top, respectively of the stack frame of the currently executing function in a program.

Snapshot of memory during execution after main has called sumFirst:

  Linked machine instructions
  Global Initialized Data
  Global Initialized Data
  Area for dynamic allocation (new or malloc)
%esp ->  Stack Frame for sumFirst
%ebp ->  
  Stack Frame for main


previous | start | next