BNDMK:

For information about interpreting this page, see the help page.
Opcode and MnemonicEncoding16 bit Mode32 bit Mode64 bit ModeCPUID Feature FlagDescription
F3 0F 1B /r
BNDMK bnd, m32
RMValidValidNot EncodableMPXMakes lower and upper bounds from m32 and stores them into bnd.
F3 0F 1B /r
BNDMK bnd, m64
RMNot EncodableNot EncodableValidMPXMakes lower and upper bounds from m64 and stores them into bnd.

Encoding

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

Description

The BNDMK instruction creates lower and upper bounds from the source operand and stores them into the bounds register in the destination operand.

The lower bound is taken from the value contained in the register pointed to by the base field of the SIB byte. The upper bound is created by computing the effective address (see LEA) of the referenced memory. At no time is memory accessed, and the flags are untouched.

Which instruction form (32 or 64 bit) is used depends on the operating mode of the processor. In 16 and 32 bit mode, the 32 bit form is used, and, in 64 bit mode, the 64 bit form is used. If a memory address is used as the second source operand, this distinction is irrelevant.

Operation

This pseudo-code uses C# syntax. A list of the types used is available here.
public void BNDMK(Bound dest, Sib addr)
{
  dest.lower = addr.base;
  dest.upper = ~lea(addr);
}

C Intrinsics

Exceptions

Protected Mode

#UD
If the LOCK prefix is used.
If ModRM.r/m does not encode BND0 through BND3 (i.e. contains a 4, 5, 6, or 7).
If the address size overload prefix (67h) is used when CS.D is 1.
If the address size overload prefix is not used when CS.D is 0.

Real-Address Mode

#UD
If the LOCK prefix is used.
If ModRM.r/m does not encode BND0 through BND3 (i.e. contains a 4, 5, 6, or 7).
If 16 bit addressing is used.

Virtual-8086 Mode

Same exceptions as real mode.

Compatibility Mode

Same exceptions as protected mode.

Long Mode

#UD
If the LOCK prefix is used.
If ModRM.r/m does not encode BND0 through BND3 (i.e. contains any of 4 through 15).
If the address size overload prefix (67h) is used when CS.D is 1.
If the address size overload prefix is not used when CS.D is 0.
If RIP-relative addressing is used.
#SS(0)
If the memory address referencing the SS segment is in non-canonical form.
#GP(0)
If the memory address is in non-canonical form.