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 2005BOUNDCheck Array BoundsChecks whether an array index (first operand) is within the bounds of an array(second operand). The array index is a signed integer in the specified register. If theoperand-size attribute is 16, the array operand is a memory location containing a pairof signed word-integers; if the operand-size attribute is 32, the array operand is a pairof signed doubleword-integers. The first word or doubleword specifies the lowerbound of the array and the second word or doubleword specifies the upper bound.The array index must be greater than or equal to the lower bound and less than orequal to the upper bound. If the index is not within the specified bounds, theprocessor generates a BOUND range-exceeded exception (#BR).The bounds of an array, consisting of two words or doublewords containing the lowerand upper limits of the array, usually reside in a data structure just before the arrayitself, making the limits addressable through a constant offset from the beginning ofthe array. With the address of the array in a register, this practice reduces the numberof bus cycles required to determine the effective address of the array bounds.Using this instruction in 64-bit mode generates an invalid-opcode exception.Mnemonic Opcode DescriptionBOUND reg16, mem16&mem16 62 /rBOUND reg32, mem32&mem32 62 /rTest whether a 16-bit array index is within the bounds specifiedby the two 16-bit values in mem16&mem16.(Invalid in 64-bit mode.)Test whether a 32-bit array index is within the bounds specifiedby the two 32-bit values in mem32&mem32.(Invalid in 64-bit mode.)Related InstructionsINT, INT3, INTOrFLAGS AffectedNone72 BOUND

24594 Rev. 3.10 February 2005 AMD64 TechnologyExceptionsException RealVirtual8086 Protected Cause of ExceptionBound range, #BR X X X The bound range was exceeded.Invalid opcode, #UD X X X The source operand was a register.X Instruction was executed in 64-bit mode.Stack, #SS X X X A memory address exceeded the stack segment limitGeneral protection, X X X A memory address exceeded a data segment limit.#GPX A null data segment was used to reference memory.Page 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.BOUND 73

24594 Rev. 3.10 February 2005 AMD64 TechnologyExceptionsException RealVirtual8086 Protected Cause of ExceptionBound range, #BR X X X The bound range was exceeded.Invalid opcode, #UD X X X The source oper<strong>and</strong> was a register.X Instruction was executed in 64-bit mode.Stack, #SS X X X A memory address exceeded the stack segment limit<strong>General</strong> protection, X X X A memory address exceeded a data segment limit.#GPX A null data segment was used to reference memory.Page 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.BOUND 73

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

Saved successfully!

Ooh no, something went wrong!