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 2005INTOInterrupt to Overflow VectorChecks the overflow flag (OF) in the rFLAGS register and calls the overflow exception(#OF) handler if the OF flag is set to 1. This instruction has no effect if the OF flag iscleared to 0. The INTO instruction detects overflow in signed number addition. SeeAMD64 Architecture Programmer’s Manual Volume 1: Application Programming for moreinformation on the OF flag.Using this instruction in 64-bit mode generates an invalid-opcode exception.For detailed descriptions of the steps performed by INT instructions, see thefollowing:• Legacy-Mode Interrupts: “Legacy Protected-Mode Interrupt Control Transfers” inVolume 2.• Long-Mode Interrupts: “Long-Mode Interrupt Control Transfers” in Volume 2.Mnemonic Opcode DescriptionINTOCECall overflow exception if the overflow flag is set.(Invalid in 64-bit mode.)ActionIF (64BIT_MODE)EXCEPTION[#UD]IF (RFLAGS.OF = 1)EXCEPTION [#OF]EXIT// #OF is a trap, and pushes the rIP of the instruction// following INTO.Related InstructionsINT, INT 3, BOUNDrFLAGS AffectedNone.ExceptionsException RealVirtual8086 Protected Cause of ExceptionOverflow, #OF X X X The INTO instruction was executed with 0F set to 1.Invalid opcode, #UD X Instruction was executed in 64-bit mode.164 INTO

24594 Rev. 3.10 February 2005 AMD64 TechnologyJccJump on ConditionChecks the status flags in the rFLAGS register and, if the flags meet the conditionspecified by the condition code in the mnemonic (cc), jumps to the target instructionlocated at the specified relative offset. Otherwise, execution continues with theinstruction following the Jcc instruction.Unlike the unconditional jump (JMP), conditional jump instructions have only twoforms—short and near conditional jumps. Different opcodes correspond to differentforms of one instruction. For example, the JO instruction (jump if overflow) hasopcode 0Fh 80h for its near form and 70h for its short form, but the mnemonic is thesame for both forms. The only difference is that the near form has a 16- or 32-bitrelative displacement, while the short form always has an 8-bit relative displacement.Mnemonics are provided to deal with the programming semantics of both signed andunsigned numbers. Instructions tagged A (above) and B (below) are intended for usein unsigned integer code; those tagged G (greater) and L (less) are intended for use insigned integer code.If the jump is taken, the signed displacement is added to the rIP (of the followinginstruction) and the result is truncated to 16, 32, or 64 bits, depending on operandsize.In 64-bit mode, the operand size defaults to 64 bits. The processor sign-extends the8-bit or 32-bit displacement value to 64 bits before adding it to the RIP.These instructions cannot perform far jumps (to other code segments). To create a farconditional-jumpcode sequence corresponding to a high-level language statementlike:IF A = B THEN GOTO FarLabelwhere FarLabel is located in another code segment, use the opposite condition in aconditional short jump before an unconditional far jump. Such a code sequence mightlook like:cmp A,B ; compare operandsjne NextInstr ; continue program if not equaljmp far FarLabel ; far jump if operands are equalNextInstr:; continue programFor details about control-flow instructions, see “Control Transfers” in Volume 1, and“Control-Transfer Privilege Checks” in Volume 2.Jcc 165

AMD64 Technology 24594 Rev. 3.10 February 2005INTOInterrupt to Overflow VectorChecks the overflow flag (OF) in the rFLAGS register <strong>and</strong> calls the overflow exception(#OF) h<strong>and</strong>ler if the OF flag is set to 1. This instruction has no effect if the OF flag iscleared to 0. The INTO instruction detects overflow in signed number addition. SeeAMD64 Architecture Programmer’s Manual <strong>Volume</strong> 1: Application Programming for moreinformation on the OF flag.Using this instruction in 64-bit mode generates an invalid-opcode exception.For detailed descriptions of the steps performed by INT instructions, see thefollowing:• Legacy-Mode Interrupts: “Legacy Protected-Mode Interrupt Control Transfers” in<strong>Volume</strong> 2.• Long-Mode Interrupts: “Long-Mode Interrupt Control Transfers” in <strong>Volume</strong> 2.Mnemonic Opcode DescriptionINTOCECall overflow exception if the overflow flag is set.(Invalid in 64-bit mode.)ActionIF (64BIT_MODE)EXCEPTION[#UD]IF (RFLAGS.OF = 1)EXCEPTION [#OF]EXIT// #OF is a trap, <strong>and</strong> pushes the rIP of the instruction// following INTO.Related <strong>Instructions</strong>INT, INT 3, BOUNDrFLAGS AffectedNone.ExceptionsException RealVirtual8086 Protected Cause of ExceptionOverflow, #OF X X X The INTO instruction was executed with 0F set to 1.Invalid opcode, #UD X Instruction was executed in 64-bit mode.164 INTO

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

Saved successfully!

Ooh no, something went wrong!