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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

AMD64 Technology 24594 Rev. 3.10 February 2005BOUNDCheck Array BoundsChecks whether an array index (first oper<strong>and</strong>) is within the bounds of an array(second oper<strong>and</strong>). The array index is a signed integer in the specified register. If theoper<strong>and</strong>-size attribute is 16, the array oper<strong>and</strong> is a memory location containing a pairof signed word-integers; if the oper<strong>and</strong>-size attribute is 32, the array oper<strong>and</strong> is a pairof signed doubleword-integers. The first word or doubleword specifies the lowerbound of the array <strong>and</strong> the second word or doubleword specifies the upper bound.The array index must be greater than or equal to the lower bound <strong>and</strong> 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 lower<strong>and</strong> 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 <strong>Instructions</strong>INT, INT3, INTOrFLAGS AffectedNone72 BOUND

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

Saved successfully!

Ooh no, something went wrong!