]>
Commit | Line | Data |
---|---|---|
1d506c26 | 1 | /* Copyright 2018-2024 Free Software Foundation, Inc. |
f5d420bb SM |
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 | /* The difference between this and arm-pseudo-unwind is that here, the CFI | |
19 | directives use the obsolete DWARF number for the s16 register (a | |
20 | pseudo-register in GDB), whereas arm-pseudo-unwind uses the number for the d8 | |
21 | register (the underlying raw register for s16). */ | |
22 | ||
23 | .section .note.GNU-stack,"",%progbits | |
24 | ||
25 | .data | |
26 | value_callee: | |
27 | .quad 0x20212223 | |
28 | value_caller: | |
29 | .quad 0x10111213 | |
30 | ||
31 | .text | |
32 | .arm | |
33 | .global callee | |
34 | callee: | |
35 | .cfi_startproc | |
36 | /* Standard prologue. */ | |
37 | push {fp, lr} | |
38 | .cfi_def_cfa fp, 4 | |
39 | .cfi_offset fp, -8 | |
40 | .cfi_offset lr, -4 | |
41 | add fp, sp, #4 | |
42 | ||
43 | /* Save caller's s16 value on the stack. */ | |
44 | .cfi_offset 80, -12 | |
45 | vpush {s16} | |
46 | ||
47 | /* Put our own s16 value. */ | |
48 | ldr r0, =value_callee | |
49 | vldr s16, [r0] | |
50 | break_here_asm: | |
51 | ||
52 | /* Restore caller's s16 value. */ | |
53 | vpop {s16} | |
54 | ||
55 | /* Standard epilogue. */ | |
56 | pop {fp, pc} | |
57 | .cfi_endproc | |
58 | ||
59 | ||
60 | .global caller | |
61 | caller: | |
62 | .cfi_startproc | |
63 | /* Standard prologue. */ | |
64 | push {fp, lr} | |
65 | .cfi_def_cfa fp, 4 | |
66 | .cfi_offset fp, -8 | |
67 | .cfi_offset lr, -4 | |
68 | add fp, sp, #4 | |
69 | ||
70 | /* Put our own s16 value. */ | |
71 | ldr r0, =value_caller | |
72 | vldr s16, [r0] | |
73 | ||
74 | /* Call callee. */ | |
75 | bl callee | |
76 | ||
77 | /* Store our s16 value in r0-r1 to return it. */ | |
78 | vpush {s16} | |
79 | pop {r0} | |
80 | mov r1, #0 | |
81 | ||
82 | /* Standard epilogue. */ | |
83 | pop {fp, pc} | |
84 | .cfi_endproc |