1 //===-- main.cpp ------------------------------------------------*- C++ -*-===//
3 //// The LLVM Compiler Infrastructure
5 //// This file is distributed under the University of Illinois Open Source
6 //// License. See LICENSE.TXT for details.
8 ////===----------------------------------------------------------------------===//
15 main(int argc, char const *argv[])
17 // This call returns 0 only if the CPU and the kernel support Intel(R) MPX.
18 if (prctl(PR_MPX_ENABLE_MANAGEMENT, 0, 0, 0, 0) != 0)
21 // Run Intel(R) MPX test code.
22 #if defined(__x86_64__)
23 asm("mov $16, %rax\n\t"
25 "bndmk (%rax,%rdx), %bnd0\n\t"
28 "bndmk (%rax,%rdx), %bnd1\n\t"
31 "bndmk (%rax,%rdx), %bnd2\n\t"
34 "bndmk (%rax,%rdx), %bnd3\n\t"
35 "bndstx %bnd3, (%rax) \n\t"
39 asm("mov $16, %eax\n\t"
41 "bndmk (%eax,%edx), %bnd0\n\t"
44 "bndmk (%eax,%edx), %bnd1\n\t"
47 "bndmk (%eax,%edx), %bnd2\n\t"
50 "bndmk (%eax,%edx), %bnd3\n\t"
51 "bndstx %bnd3, (%eax)\n\t"
54 asm("nop\n\t"); // Set a break point here.