13.07.2015 Views

Volume 3: General-Purpose and System Instructions - Stanford ...

Volume 3: General-Purpose and System Instructions - Stanford ...

Volume 3: General-Purpose and System Instructions - Stanford ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

24594 Rev. 3.10 February 2005 AMD64 TechnologyRET (Near)Near Return from Called ProcedureReturns from a procedure previously entered by a CALL near instruction. This form ofthe RET instruction returns to a calling procedure within the current code segment.This instruction pops the rIP from the stack, with the size of the pop determined bythe oper<strong>and</strong> size. The new rIP is then zero-extended to 64 bits. The RET instructioncan accept an immediate value oper<strong>and</strong> that it adds to the rSP after it pops the targetrIP. This action skips over any parameters previously passed back to the subroutinethat are no longer needed.In 64-bit mode, the oper<strong>and</strong> size defaults to 64 bits (eight bytes) without the need for aREX prefix. No prefix is available to encode a 32-bit oper<strong>and</strong> size in 64-bit mode.See RET (Far) for information on far returns—returns to procedures located outsideof the current code segment. For details about control-flow instructions, see “ControlTransfers” in <strong>Volume</strong> 1, <strong>and</strong> “Control-Transfer Privilege Checks” in <strong>Volume</strong> 2.Mnemonic Opcode DescriptionRET C3 Near return to the calling procedure.RET imm16Related <strong>Instructions</strong>C2 iwNear return to the calling procedure then pop of the specifiednumber of bytes from the stack.CALL (Near), CALL (Far), RET (Far)rFLAGS AffectedNoneExceptionsException RealVirtual8086 Protected Cause of ExceptionStack, #SS X X X A memory address exceeded the stack segment limit or was noncanonical.<strong>General</strong> protection,#GPX X X The target offset exceeded the code segment limit or was non-canonical.RET (Near) 245

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!