x86 Assembly Language Reference Manual

High Level Procedure Exit (leave)

leave
Operation

set (E)SP to (E)BP, then pop (E)BP

Description

The leave instruction reverses the actions of an enter instruction. leave copies the frame pointer to the stack point and releases the stack space formerly used by a procedure for its local variables. leave pops the old frame pointer into (E)BP, thus restoring the caller's frame. A subsequent ret nn instruction removes any arguments pushed onto the stack of the exiting procedure.

Example

Copy the frame pointer to the stack pointer and release the stack space.

leave