4-2
PROCEDURE CALLS, INTERRUPTS, AND EXCEPTIONS
many stacks, only one stackthe current stackis available at a time. The current stack is the
one contained in the segment referenced by the SS register.
The processor references the SS register automatically for all stack operations. For example,
when the ESP register is used as a memory address, it automatically points to an address in the
current stack. Also, the CALL, RET, PUSH, POP, ENTER, and LEAVE instructions all perform
operations on the current stack.
Figure 4-1. Stack Structure
Bottom of Stack
(Initial ESP Value)
Local Variables
for Calling
Procedure
Parameters
Passed to
Called
Procedure
Frame Boundary
EBP Register
ESP Register
Return Instruction
Top of Stack
Stack Segment
Pushes Move the
Top Of Stack to
Lower Addresses
Pops Move the
Top Of Stack to
Higher Addresses
The EBP register is
The Stack Can Be
16 or 32 Bits Wide
typically set to point
to the return
instruction pointer.
Pointer