1 /* Check if the OS supports executing MPX instructions. */ 2 3 #define XCR_XFEATURE_ENABLED_MASK 0x0 4 5 #define XSTATE_BNDREGS 0x8 6 7 static int mpx_os_support(void)8mpx_os_support (void) 9 { 10 unsigned int eax, edx; 11 unsigned int ecx = XCR_XFEATURE_ENABLED_MASK; 12 13 __asm__ ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (ecx)); 14 15 return (eax & XSTATE_BNDREGS) != 0; 16 } 17