Intel 80287, 80286 manual BOUND-Check Array Index Against Bounds, Bound rw,md noj=13

Models: 80287 80286

1 515
Download 515 pages 45.04 Kb
Page 232
Image 232

THE 80286 INSTRUCTION SET

BOUND-Check Array Index Against Bounds

OpcodeInstruction ClocksDescription

62. /r

BOUND rw,md noj=13

INT 5 if rw not within bounds

FLAGS MODIFIED

None

FLAGS UNDEFINED

None

OPERATION

BOUND is used to ensure that a signed array index is within the limits defined by a two-word block of memory. The first operand (a register) tnustbe greater than or equal to the first word in memory, and ·less than or equal to the second word in memory. If the register is not within the bounds, an

INTERRUPT 5 occurs.

.

The two-word block might typically be found just before the array itself and therefore would be acces- sible at a constant offset of -4 from the array, simplifying the addressing.

PROTECTED MODE EXCEPTIONS.

INTERRUPT 5 if the bounds test fails, as described above. #GP(O) for an illegal memory operand effective address in the C8, D8, or E8 segments; #88(0) for an illegal address in the 88 segment.

The second operand must be a memory operand, not a register. If the BOUND instruction is executed with a ModRM byte representing a register second operand, then fault #UD will occUr.

REAL ADDRESS MODE EXCEPTIONS

INTERRUPT 5 if the bounds test fails, as described above. Interrupt 13 for a second operand at offset OFFFDH or higher. Interrupt 6 if the second operand is a register,as described in the paragraph above.

B-22

Page 232
Image 232
Intel 80287, 80286 manual BOUND-Check Array Index Against Bounds, Bound rw,md noj=13