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

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

scs.stanford.edu
from scs.stanford.edu More from this publisher
13.07.2015 Views

AMD64 Technology 24594 Rev. 3.10 February 2005ExceptionRealVirtual8086 Protected Cause of ExceptionPage fault, #PF X X A page fault resulted from the execution of the instruction.Alignment check, #AC X X An unaligned memory reference was performed while alignmentchecking was enabled.246 RET (Near)

24594 Rev. 3.10 February 2005 AMD64 TechnologyRET (Far)Far Return from Called ProcedureReturns from a procedure previously entered by a CALL Far instruction. This form ofthe RET instruction returns to a calling procedure in a different segment than thecurrent code segment. It can return to the same CPL or to a less privileged CPL.RET Far pops a target CS and rIP from the stack. If the new code segment is lessprivileged than the current code segment, the stack pointer is incremented by thenumber of bytes indicated by the immediate operand, if present; then a new SS andrSP are also popped from the stack.The final value of rSP is incremented by the number of bytes indicated by theimmediate operand, if present. This action skips over the parameters (previouslypassed to the subroutine) that are no longer needed.All stack pops are determined by the operand size. If necessary, the target rIP is zeroextendedto 64 bits before assuming program control.If the CPL changes, the data segment selectors are set to NULL for any of the datasegments (DS, ES, FS, GS) not accessible at the new CPL.See RET (Near) for information on near returns—returns to procedures located insidethe current code segment. For details about control-flow instructions, see “ControlTransfers” in Volume 1, and “Control-Transfer Privilege Checks” in Volume 2.Mnemonic Opcode DescriptionRETF CB Far return to the calling procedure.RETF imm16CA iwFar return to the calling procedure, then pop of the specifiednumber of bytes from the stack.Action// Far returns (RETF)// See “Pseudocode Definitions” on page 49.RETF_START:IF (REAL_MODE)RETF_REAL_OR_VIRTUALELSIF (PROTECTED_MODE)RETF_PROTECTEDELSE // (VIRTUAL_MODE)RETF_REAL_OR_VIRTUALRET (Far) 247

AMD64 Technology 24594 Rev. 3.10 February 2005ExceptionRealVirtual8086 Protected Cause of ExceptionPage fault, #PF X X A page fault resulted from the execution of the instruction.Alignment check, #AC X X An unaligned memory reference was performed while alignmentchecking was enabled.246 RET (Near)

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

Saved successfully!

Ooh no, something went wrong!