]>
Commit | Line | Data |
---|---|---|
29d73ae4 DJ |
1 | /* Unwinder test program. |
2 | ||
6aba47ca | 3 | Copyright 2006, 2007 Free Software Foundation, Inc. |
29d73ae4 DJ |
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 2 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, write to the Free Software | |
19 | Foundation, Inc., 59 Temple Place - Suite 330, | |
20 | Boston, MA 02111-1307, USA. */ | |
21 | ||
22 | void tpcs_frame (void); | |
23 | ||
24 | int | |
25 | main (void) | |
26 | { | |
27 | tpcs_frame (); | |
28 | return 0; | |
29 | } | |
30 | ||
31 | /* Normally Thumb functions use r7 as the frame pointer. However, | |
32 | with the GCC option -mtpcs-frame, they may use fp instead. */ | |
33 | ||
34 | asm(".text\n" | |
35 | " .align 2\n" | |
36 | " .thumb_func\n" | |
37 | " .code 16\n" | |
38 | "tpcs_frame_1:\n" | |
39 | " sub sp, #16\n" | |
40 | " push {r7}\n" | |
41 | " add r7, sp, #20\n" | |
42 | " str r7, [sp, #8]\n" | |
43 | " mov r7, pc\n" | |
44 | " str r7, [sp, #16]\n" | |
45 | " mov r7, fp\n" | |
46 | " str r7, [sp, #4]\n" | |
47 | " mov r7, lr\n" | |
48 | " str r7, [sp, #12]\n" | |
49 | " add r7, sp, #16\n" | |
50 | " mov fp, r7\n" | |
51 | " mov r7, sl\n" | |
52 | " push {r7}\n" | |
53 | ||
54 | /* Trap. */ | |
55 | " .short 0xdffe\n" | |
56 | ||
57 | " pop {r2}\n" | |
58 | " mov sl, r2\n" | |
59 | " pop {r7}\n" | |
60 | " pop {r1, r2}\n" | |
61 | " mov fp, r1\n" | |
62 | " mov sp, r2\n" | |
63 | " bx lr\n" | |
64 | ||
65 | " .align 2\n" | |
66 | " .thumb_func\n" | |
67 | " .code 16\n" | |
68 | "tpcs_frame:\n" | |
69 | " sub sp, #16\n" | |
70 | " push {r7}\n" | |
71 | " add r7, sp, #20\n" | |
72 | " str r7, [sp, #8]\n" | |
73 | " mov r7, pc\n" | |
74 | " str r7, [sp, #16]\n" | |
75 | " mov r7, fp\n" | |
76 | " str r7, [sp, #4]\n" | |
77 | " mov r7, lr\n" | |
78 | " str r7, [sp, #12]\n" | |
79 | " add r7, sp, #16\n" | |
80 | " mov fp, r7\n" | |
81 | " mov r7, sl\n" | |
82 | " push {r7}\n" | |
83 | ||
84 | /* Clobber saved regs. */ | |
85 | " mov r7, #0\n" | |
86 | " mov lr, r7\n" | |
87 | " bl tpcs_frame_1\n" | |
88 | ||
89 | " pop {r2}\n" | |
90 | " mov sl, r2\n" | |
91 | " pop {r7}\n" | |
92 | " pop {r1, r2}\n" | |
93 | " mov fp, r1\n" | |
94 | " mov sp, r2\n" | |
95 | " bx lr\n" | |
96 | ); |