Add translations for various sub-directories
[binutils-gdb.git] / gdb / testsuite / gdb.arch / amd64-disp-step.S
blobed805daba1ce6974f1c8954dc38d7ee2872bb751
1 /* Copyright 2009-2024 Free Software Foundation, Inc.
3    This program is free software; you can redistribute it and/or modify
4    it under the terms of the GNU General Public License as published by
5    the Free Software Foundation; either version 3 of the License, or
6    (at your option) any later version.
8    This program is distributed in the hope that it will be useful,
9    but WITHOUT ANY WARRANTY; without even the implied warranty of
10    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11    GNU General Public License for more details.
13    You should have received a copy of the GNU General Public License
14    along with this program.  If not, see <http://www.gnu.org/licenses/>.
16    This file is part of the gdb testsuite.
17    It tests displaced stepping over various insns that require special
18    handling.  */
20         .text
22         .global main
23 main:
24         nop
26         callq   setup_signal_handler
28         nop
30 /***********************************************/
32 /* test call/ret */
34         .global test_call
35 test_call:
36         call test_call_subr
37         nop
38         .global test_ret_end
39 test_ret_end:
40         nop
42 /***********************************************/
44 /* test abs-jmp/rep-ret */
46 test_abs_jmp_setup:
47         mov $test_abs_jmp_return,%rdx
48         push %rdx
49         mov $test_abs_jmp_subr,%rdx
50         .global test_abs_jmp
51 test_abs_jmp:
52         jmp *%rdx
53 test_abs_jmp_return:
54         nop
55         .global test_rep_ret_end
56 test_rep_ret_end:
57         nop
59 /***********************************************/
61 /* test syscall */
63         .global test_syscall
64         mov $0x27,%eax /* getpid */
65 test_syscall:
66         syscall
67         nop
68 test_syscall_end:
69         nop
71 /***********************************************/
73 /* Test stepping over int3.
74    The prefixes are pointless, but it's possible, so we exercise it.  */
76         nop
77         .global test_int3
78 test_int3:
79         repz
80         repz
81         int3
82         nop
83         .global test_int3_end
84 test_int3_end:
85         nop
87 /***********************************************/
89 /* test rip-relative
90    GDB picks a spare register to hold the rip-relative address.
91    Exercise all the possibilities (rax-rdi, sans rsp).  */
93         .global test_rip_rax
94 test_rip_rax:
95         add answer(%rip),%rax
96         .global test_rip_rax_end
97 test_rip_rax_end:
98         nop
100         .global test_rip_rbx
101 test_rip_rbx:
102         add answer(%rip),%rbx
103         .global test_rip_rbx_end
104 test_rip_rbx_end:
105         nop
107         .global test_rip_rcx
108 test_rip_rcx:
109         add answer(%rip),%rcx
110         .global test_rip_rcx_end
111 test_rip_rcx_end:
112         nop
114         .global test_rip_rdx
115 test_rip_rdx:
116         add answer(%rip),%rdx
117         .global test_rip_rdx_end
118 test_rip_rdx_end:
119         nop
121         .global test_rip_rbp
122 test_rip_rbp:
123         add answer(%rip),%rbp
124         .global test_rip_rbp_end
125 test_rip_rbp_end:
126         nop
128         .global test_rip_rsi
129 test_rip_rsi:
130         add answer(%rip),%rsi
131         .global test_rip_rsi_end
132 test_rip_rsi_end:
133         nop
135         .global test_rip_rdi
136 test_rip_rdi:
137         add answer(%rip),%rdi
138         .global test_rip_rdi_end
139 test_rip_rdi_end:
140         nop
142         .global test_jmp
143 test_jmp:
144         jmpq    *jmp_dest(%rip)
145         nop
146         .global test_jmp_end
147 test_jmp_end:
148         nop
150         /* skip over test data */
151         jmp done
153 /* test rip-relative data */
155 answer: .8byte 42
157 jmp_dest:
158         .8byte  test_jmp_end
160 /***********************************************/
162 /* all done */
164 done:
165         mov $0,%rdi
166         call exit
167         hlt
169 /***********************************************/
171 /* subroutine to help test call/ret */
173 test_call_subr:
174         nop
175         .global test_call_end
176 test_call_end:
177         nop
179         .global test_ret
180 test_ret:
181         ret
183 /***********************************************/
185 /* subroutine to help test abs-jmp/rep-ret */
187 test_abs_jmp_subr:
188         nop
189         .global test_abs_jmp_end
190 test_abs_jmp_end:
191         nop
193         .global test_rep_ret
194 test_rep_ret:
195         repz
196         ret
197         .section        .note.GNU-stack,"",@progbits