Intel® Memory Protection Extensions (Intel® MPX) Runtime Support

By Brian L Vajda,

Published:07/23/2013   Last Updated:07/23/2013

NOTE: Intel® Memory Protection Extensions (Intel® MPX) have been deprecated and are not available on all future processors.

Enabling an application to use Intel MPX will generally not require source code updates but there is some runtime code needed in order to make use of Intel MPX.  For most applications this runtime support will be available by linking to a library supplied by the compiler or possibly it will come directly from the OS once OS versions that support Intel MPX are available.  The runtime code has 3 responsibilities: 

  1. Configuring and enabling Intel MPX:
    The configuration and enabling of Intel MPX consists of the runtime writing the base address of the Bound Directory(BD) to the BNDCFGU register and setting the enable bit.  The runtime library performs this enabling for each thread in an application.
  2. Managing bounds memory:
    Intel MPX defines 4 sets of bound registers.  When an application needs more than 4 sets of bounds it uses the BNDSTX instruction to save the additional bounds out to memory.  The runtime library dynamically allocates the memory used to store these bounds.  The bounds memory is organized into a 2 level structure consisting of a BD which contains pointers to a set of Bound Tables (BT) which contain the actual bound information (See the Intel® Architecture Instruction Set Extensions Programming Reference for detailed descriptions of these structures).  In order to minimize the Intel MPX memory usage the BTs are allocated on demand by the Intel MPX runtime.
  3. Providing handlers for bounds faults (#BR):
    When Intel MPX is enabled, there are 2 new situations that can generate #BR faults.  If a bounds overflow occurs then a #BR is generated.   The default action of the runtime fault handler is to terminate the application on this type of fault.  The other case that generates a #BR is when a BNDSTX instruction attempts to save bounds to a BD entry marked as invalid.  This is an indication to the runtime that no BT exists for this entry.  In this case the runtime fault handler will allocate a new BT.

In future blogs I will go into more detail on how the runtime library manages bounds memory and handles faults.

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at