gdb - avx512: tests were failing due to missing memory aligment.
[external/binutils.git] / gdb / testsuite / gdb.arch / s390-tdbregs.c
1 /* Copyright 2008-2017 Free Software Foundation, Inc.
2
3    This file is part of GDB.
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3 of the License, or
8    (at your option) any later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17
18 #include <stdio.h>
19
20 static void
21 my_tbegin ()
22 {
23   __asm__ volatile
24     ( "1:  .byte 0xe5,0x60,0x00,0x00,0xff,0x00\n"
25       "    jnz 1b"
26       : /* no return value */
27       : /* no inputs */
28       : "cc", "memory" );
29 }
30
31 static void
32 my_tend ()
33 {
34   __asm__ volatile
35     ( "    .byte 0xb2,0xf8,0x00,0x00"
36       : /* no return value */
37       : /* no inputs */
38       : "cc", "memory" );
39 }
40
41 void
42 try_transaction (void)
43 {
44   my_tbegin ();
45   my_tend ();
46 }
47
48 void
49 crash_in_transaction (void)
50 {
51   volatile char *p = 0;
52
53   my_tbegin ();
54   *p = 5;                       /* FAULT */
55   my_tend ();
56 }
57
58 int
59 main (int argc, char *argv[])
60 {
61   try_transaction ();
62   crash_in_transaction ();
63   return 0;
64 }