xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.arch/i386-mpx.c (revision 7bdf38e5b7a28439665f2fdeff81e36913eef7dd)
1 /* Test program for MPX registers.
2 
3    Copyright 2013-2023 Free Software Foundation, Inc.
4 
5    This file is part of GDB.
6 
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11 
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16 
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19 
20 int
21 main (void)
22 {
23 #ifdef __x86_64__
24   asm ("mov $10, %rax\n\t"
25        "mov $9, %rdx\n\t"
26        "bndmk (%rax,%rdx), %bnd0\n\t"
27        "mov $20, %rax\n\t"
28        "mov $9, %rdx\n\t"
29        "bndmk (%rax,%rdx), %bnd1\n\t"
30        "mov $30, %rax\n\t"
31        "mov $9, %rdx\n\t"
32        "bndmk (%rax,%rdx), %bnd2\n\t"
33        "mov $40, %rax\n\t"
34        "mov $9, %rdx\n\t"
35        "bndmk (%rax,%rdx), %bnd3\n\t"
36        "bndstx %bnd3, (%rax) \n\t"
37        "nop\n\t"
38        );
39 #else
40   asm ("mov $10, %eax\n\t"
41        "mov $9, %edx\n\t"
42        "bndmk (%eax,%edx), %bnd0\n\t"
43        "mov $20, %eax\n\t"
44        "mov $9, %edx\n\t"
45        "bndmk (%eax,%edx), %bnd1\n\t"
46        "mov $30, %eax\n\t"
47        "mov $9, %edx\n\t"
48        "bndmk (%eax,%edx), %bnd2\n\t"
49        "mov $40, %eax\n\t"
50        "mov $9, %edx\n\t"
51        "bndmk (%eax,%edx), %bnd3\n\t"
52        "bndstx  %bnd3, (%eax)\n\t"
53        "nop\n\t"
54        );
55 #endif
56   asm ("nop\n\t");	/* break here.  */
57 
58   return 0;
59 }
60