previous | start | next

IA32 Functions: Return

When f returns, it must

  1. deallocate all the space for all its local variables and restore the stack frame for its caller, main.
    In short, it must pop the stack!
  2. reload the program counter register, %eip, with the address of the instruction just after the call instruction in main.

Local variables are deallocated by simply changing the the stack pointer register to point to the bottom of the current stack frame.

Data in local variable memory locations may not actually be erased, but this data will no longer be accessible on return to the caller and will be overwritten if another function is called.



previous | start | next