run copyright.sh for 2011.
[external/binutils.git] / gdb / testsuite / gdb.arch / i386-disp-step.S
1 /* Copyright 2009, 2010, 2011 Free Software Foundation, Inc.
2
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.
7
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.
12
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/>.
15
16    This file is part of the gdb testsuite.
17    It tests displaced stepping over various insns that require special
18    handling.  */
19
20         .text
21
22         .global main
23 main:
24         nop
25
26 /***********************************************/
27
28 /* Test call/ret.  */
29
30         nop
31         .global test_call
32 test_call:
33         call test_call_subr
34         nop
35         .global test_ret_end
36 test_ret_end:
37         nop
38
39 /***********************************************/
40
41 /* Absolute jump with leading prefixes.
42    These don't occur in normal code, but gdb should still DTRT.  */
43
44         nop
45         .global test_prefixed_abs_jump
46 test_prefixed_abs_jump:
47         ds
48         jmp *test_prefixed_abs_jump_addr
49         .data
50 test_prefixed_abs_jump_addr:
51         .4byte test_prefixed_abs_jump_target
52         .text
53 test_prefixed_abs_jump_target:
54         nop
55         .global test_prefixed_abs_jump_end
56 test_prefixed_abs_jump_end:
57         nop
58
59 /***********************************************/
60
61 /* Test syscall.  */
62
63         mov $0x14,%eax /* getpid */
64         .global test_syscall
65 test_syscall:
66         int $0x80
67         nop
68         .global test_syscall_end
69 test_syscall_end:
70         nop
71
72 /***********************************************/
73
74 /* Test syscall again, this time with a prefix.
75    These don't occur in normal code, but gdb should still DTRT.  */
76
77         mov $0x14,%eax /* getpid */
78         .global test_prefixed_syscall
79 test_prefixed_syscall:
80         repnz
81         int $0x80
82         nop
83         .global test_prefixed_syscall_end
84 test_prefixed_syscall_end:
85         nop
86
87 /***********************************************/
88
89 /* Test stepping over int3.
90    The prefixes are pointless, but it's possible, so we exercise it.  */
91
92         nop
93         .global test_int3
94 test_int3:
95         repz
96         repz
97         int3
98         nop
99         .global test_int3_end
100 test_int3_end:
101         nop
102
103 /***********************************************/
104
105 /* all done */
106
107         pushl $0
108         call exit
109         hlt
110
111 /***********************************************/
112
113 /* subroutine to help test call/ret */
114
115 test_call_subr:
116         nop
117         .global test_call_end
118 test_call_end:
119         nop
120
121         .global test_ret
122 test_ret:
123         ret