LEAVE—High Level Procedure ExitInstruction Operand EncodingDescriptionReleases the stack frame set up by an earlier ENTER instruction. The LEAVE instruction copies the frame pointer (in the EBP register) into the stack pointer register (ESP), which releases the stack space allocated to the stack frame. The old frame pointer (the frame pointer for the calling procedure that was saved by the ENTER instruction) is then popped from the stack into the EBP register, restoring the calling procedure’s stack frame. A RET instruction is commonly executed following a LEAVE instruction to return program control to the calling procedure.See “Procedure Calls for Block-Structured Languages” in Chapter 7 of the Intel® 64 and IA-32 Architectures Soft-ware Developer’s Manual, Volume 1, for detailed information on the use of the ENTER and LEAVE instructions.In 64-bit mode, the instruction’s default operation size is 64 bits; 32-bit operation cannot be encoded. See the summary chart at the beginning of this section for encoding data and limits.OperationIF StackAddressSize= 32THENESP := EBP;ELSE IF StackAddressSize= 64THEN RSP := RBP; FI;ELSE IF StackAddressSize= 16THEN SP := BP; FI;FI;IF OperandSize = 32THEN EBP := Pop();ELSE IF OperandSize= 64THEN RBP := Pop(); FI;ELSE IF OperandSize = 16THEN BP := Pop(); FI;FI;Flags AffectedNoneOpcodeInstructionOp/ En64-Bit ModeCompat/Leg ModeDescriptionC9LEAVEZOValidValidSet SP to BP, then pop BP.C9LEAVEZON.E.ValidSet ESP to EBP, then pop EBP.C9LEAVEZOValidN.E.Set RSP to RBP, then pop RBP.Op/EnOperand 1Operand 2Operand 3Operand 4ZONANANANA
This UNOFFICIAL reference was generated from the official Intel® 64 and IA-32 Architectures Software Developer’s Manual by a dumb script. There is no guarantee that some parts aren't mangled or broken and is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.