Check Lower Bound

Encoding

EncodingOperand 1Operand 2
rmModRM.reg[r]ModRM.r/m[r]

Description

The BNDCL instruction compares the address in the second source operand against the lower bound in the first source operand. If the second source is lower (outside the bounds), a #BR exception is raised and BNDSTATUS is set to 1.

If the second source operand is a general purpose register, the value contained in it is treated as the address to compare against. If, however, it is a memory location, the effective address is calculated (see LEA - Load Effective Address) and used in the comparison. At no time is memory accessed.

Which instruction form is used depends on the operating mode of the processor. In 16-bit and 32-bit modes, the 32-bit form is used. In 64-bit mode, the 64-bit form is used.

Operation

public void BNDCL(Bound bnd, IntPtr addr)
{
    if (addr < bnd.Lower)
    {
        BNDSTATUS.Abd = 0;
        BNDSTATUS.EC = 1; // bounds violation
        #BR;
    }
}

Flags Affected

None.

Intrinsics

Exceptions

Real-Address Mode

#BR
  • If the bounds test fails.
#UD
  • If the LOCK prefix is used.
  • If 16 bit addressing is used, or 32 or 64 bit addressing is used, but without an SIB byte (rm is not 100b).
  • If a register operand encodes BND4 through BND7.

Virtual-8086 Mode

#BR
  • If the bounds test fails.
#UD
  • If the LOCK prefix is used.
  • If 16 bit addressing is used, or 32 or 64 bit addressing is used, but without an SIB byte (rm is not 100b).
  • If a register operand encodes BND4 through BND7.

Protected Mode

#BR
  • If the bounds test fails.
#UD
  • If the LOCK prefix is used.
  • If 16 bit addressing is used, or 32 or 64 bit addressing is used, but without an SIB byte (rm is not 100b).
  • If a register operand encodes BND4 through BND7.

Compatibility Mode

#BR
  • If the bounds test fails.
#UD
  • If the LOCK prefix is used.
  • If 16 bit addressing is used, or 32 or 64 bit addressing is used, but without an SIB byte (rm is not 100b).
  • If a register operand encodes BND4 through BND7.

Long Mode

#BR
  • If the bounds test fails.
#UD
  • If the LOCK prefix is used.
  • If 16 bit addressing is used, or 32 or 64 bit addressing is used, but without an SIB byte (rm is not 100b).
  • If a register operand encodes BND4 through BND7.