xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.arch/aarch64-prologue.c (revision 924795e69c8bb3f17afd8fcbb799710cc1719dc4)
1 /* This testcase is part of GDB, the GNU debugger.
2 
3    Copyright 2019-2020 Free Software Foundation, Inc.
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 extern void excessiveprologue ();
21 
22 void
23 innerfunc ()
24 {
25   printf ("inner\n");
26 }
27 
28 /* excessiveprologue saves to the stack in multiple ways.  */
29 
30 asm ("\t.section .gnu.sgstubs,\"ax\",%progbits\n"
31      "\t.global excessiveprologue\n"
32      "\t.type excessiveprologue, %function\n"
33      "excessiveprologue:\n"
34      "\tstp	x29, x30, [sp, #-208]!\n"
35      "\tmov	x29, sp\n"
36      "\tstp	w0,w1,[sp,16]\n"
37      "\tstp	x2,x3,[sp,24]\n"
38      "\tstr	w4,[sp,40]\n"
39      "\tstr	x5,[sp,48]\n"
40      "\tstur	w6,[sp,52]\n"
41      "\tstur	x7,[sp,56]\n"
42      "\tstp	s0,s1,[sp,64]\n"
43      "\tstp	d2,d3,[sp,72]\n"
44      "\tstp	q4,q5,[sp,96]\n"
45      "\tstr	b6,[sp,128]\n"
46      "\tstr	h7,[sp,132]\n"
47      "\tstr	s8,[sp,136]\n"
48      "\tstr	d9,[sp,140]\n"
49      "\tstr	q10,[sp,148]\n"
50      "\tstur	b11,[sp,164]\n"
51      "\tstur	h12,[sp,160]\n"
52      "\tstur	s13,[sp,172]\n"
53      "\tstur	d14,[sp,176]\n"
54      "\tstur	q15,[sp,184]\n"
55      "\tbl innerfunc\n"
56      "\tldp	w0,w1,[sp,16]\n"
57      "\tldp	x2,x3,[sp,24]\n"
58      "\tldr	w4,[sp,40]\n"
59      "\tldr	x5,[sp,48]\n"
60      "\tldur	w6,[sp,52]\n"
61      "\tldur	x7,[sp,56]\n"
62      "\tldp	s0,s1,[sp,64]\n"
63      "\tldp	d2,d3,[sp,72]\n"
64      "\tldp	q4,q5,[sp,96]\n"
65      "\tldr	b6,[sp,128]\n"
66      "\tldr	h7,[sp,132]\n"
67      "\tldr	s8,[sp,136]\n"
68      "\tldr	d9,[sp,140]\n"
69      "\tldr	q10,[sp,148]\n"
70      "\tldur	b11,[sp,164]\n"
71      "\tldur	h12,[sp,160]\n"
72      "\tldur	s13,[sp,172]\n"
73      "\tldur	d14,[sp,176]\n"
74      "\tldur	q15,[sp,184]\n"
75      "\tldp	x29, x30, [sp], #208\n"
76      "ret\n");
77 
78 int
79 main (void)
80 {
81   excessiveprologue ();
82   return 0;
83 }
84