Intel® ISA Extensions
Use hardware-based isolation and memory encryption to provide more code protection in your solutions.

Working assembly example for MPX?

c_43
Beginner
578 Views

Does there already exist some small working example of an assembly program that enables MPX and demonstrates (some) of the instructions -- when executed in the SDE? I am aware that MPX appears to be enabled in libmpx. However I'd like to see this done by hand without using libmpx, assemble the program using an MPX enabled NASM and of course still run it in the SDE, just to play around with it.

I've already looked for this without finding anything, if someone could point me to such an already existing example that would be great.

0 Kudos
2 Replies
c_43
Beginner
578 Views

I'm reading the "Intel® Architecture Instruction Set Extensions Programming Reference" manual, on p. 60, we have:

"The layout of the Ext_SAVE_Area_4[BNDCSR] contains the processor state of bounds configuration and status of Intel MPX, which is described in Section 9.3.2."

In Section 9.3.2. pp. 848-849, there is some elaboration, e.g. the state of the system when setting certain bits (Table 9-1).

However, there doesn't appear to be any overview or explanation of the exact layout of the Ext_SAVE_Area_4[BNDCSR]. Am I simply overlooking it? Is it found somewhere else in the manual? In particular, what bit(s) are supposed to be set in this area to control the enabled bit in BNDCFGU, when using XSAVE/XRESTOR?

I'm trying to manually enable this bit from user space.

0 Kudos
c_43
Beginner
578 Views

I should add that I just tried enabling all of them, and that enabled the enable bit (among other things, setting everything to 0xff ...). I can figure out what is what this way, but it would be nice to just see the layout.

0 Kudos
Reply