| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: i386_trap.S,v 1.6 2017/02/27 06:46:59 chs Exp $ */ | | 1 | /* $NetBSD: i386_trap.S,v 1.7 2017/06/14 17:02:16 maxv Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright 2002 (c) Wasabi Systems, Inc. | | 4 | * Copyright 2002 (c) Wasabi Systems, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Written by Frank van der Linden for Wasabi Systems, Inc. | | 7 | * Written by Frank van der Linden for Wasabi Systems, Inc. |
8 | * | | 8 | * |
9 | * Redistribution and use in source and binary forms, with or without | | 9 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 10 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 11 | * are met: |
12 | * 1. Redistributions of source code must retain the above copyright | | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -25,27 +25,27 @@ | | | @@ -25,27 +25,27 @@ |
25 | * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND | | 25 | * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND |
26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
27 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 27 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
28 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC | | 28 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC |
29 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 29 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
35 | * POSSIBILITY OF SUCH DAMAGE. | | 35 | * POSSIBILITY OF SUCH DAMAGE. |
36 | */ | | 36 | */ |
37 | | | 37 | |
38 | /*- | | 38 | /* |
39 | * Copyright (c) 1998, 2007, 2009 The NetBSD Foundation, Inc. | | 39 | * Copyright (c) 1998, 2007, 2009 The NetBSD Foundation, Inc. |
40 | * All rights reserved. | | 40 | * All rights reserved. |
41 | * | | 41 | * |
42 | * This code is derived from software contributed to The NetBSD Foundation | | 42 | * This code is derived from software contributed to The NetBSD Foundation |
43 | * by Charles M. Hannum, and by Andrew Doran. | | 43 | * by Charles M. Hannum, and by Andrew Doran. |
44 | * | | 44 | * |
45 | * Redistribution and use in source and binary forms, with or without | | 45 | * Redistribution and use in source and binary forms, with or without |
46 | * modification, are permitted provided that the following conditions | | 46 | * modification, are permitted provided that the following conditions |
47 | * are met: | | 47 | * are met: |
48 | * 1. Redistributions of source code must retain the above copyright | | 48 | * 1. Redistributions of source code must retain the above copyright |
49 | * notice, this list of conditions and the following disclaimer. | | 49 | * notice, this list of conditions and the following disclaimer. |
50 | * 2. Redistributions in binary form must reproduce the above copyright | | 50 | * 2. Redistributions in binary form must reproduce the above copyright |
51 | * notice, this list of conditions and the following disclaimer in the | | 51 | * notice, this list of conditions and the following disclaimer in the |
| @@ -56,210 +56,225 @@ | | | @@ -56,210 +56,225 @@ |
56 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 56 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
57 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 57 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
58 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 58 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
59 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 59 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
60 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 60 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
61 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 61 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
62 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 62 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
63 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 63 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
64 | * POSSIBILITY OF SUCH DAMAGE. | | 64 | * POSSIBILITY OF SUCH DAMAGE. |
65 | */ | | 65 | */ |
66 | | | 66 | |
67 | #if 0 | | 67 | #if 0 |
68 | #include <machine/asm.h> | | 68 | #include <machine/asm.h> |
69 | __KERNEL_RCSID(0, "$NetBSD: i386_trap.S,v 1.6 2017/02/27 06:46:59 chs Exp $"); | | 69 | __KERNEL_RCSID(0, "$NetBSD: i386_trap.S,v 1.7 2017/06/14 17:02:16 maxv Exp $"); |
70 | #endif | | 70 | #endif |
71 | | | 71 | |
72 | /* | | 72 | /* |
73 | * Trap and fault vector routines | | 73 | * Trap and fault vector routines |
74 | * | | 74 | * |
75 | * On exit from the kernel to user mode, we always need to check for ASTs. In | | 75 | * On exit from the kernel to user mode, we always need to check for ASTs. In |
76 | * addition, we need to do this atomically; otherwise an interrupt may occur | | 76 | * addition, we need to do this atomically; otherwise an interrupt may occur |
77 | * which causes an AST, but it won't get processed until the next kernel entry | | 77 | * which causes an AST, but it won't get processed until the next kernel entry |
78 | * (possibly the next clock tick). Thus, we disable interrupt before checking, | | 78 | * (possibly the next clock tick). Thus, we disable interrupt before checking, |
79 | * and only enable them again on the final `iret' or before calling the AST | | 79 | * and only enable them again on the final `iret' or before calling the AST |
80 | * handler. | | 80 | * handler. |
81 | */ | | 81 | */ |
82 | | | 82 | |
83 | #define TRAP(a) pushl $(a) ; jmp _C_LABEL(alltraps) | | 83 | #define TRAP(a) pushl $(a) ; jmp _C_LABEL(alltraps) |
84 | #define ZTRAP(a) pushl $0 ; TRAP(a) | | 84 | #define ZTRAP(a) pushl $0 ; TRAP(a) |
85 | | | 85 | |
86 | #ifdef IPKDB | | 86 | #ifdef IPKDB |
87 | #define BPTTRAP(a) pushl $0; pushl $(a); jmp _C_LABEL(bpttraps) | | 87 | #define BPTTRAP(a) pushl $0; pushl $(a); jmp _C_LABEL(bpttraps) |
88 | #else | | 88 | #else |
89 | #define BPTTRAP(a) ZTRAP(a) | | 89 | #define BPTTRAP(a) ZTRAP(a) |
90 | #endif | | 90 | #endif |
91 | | | 91 | |
92 | | | | |
93 | .text | | 92 | .text |
94 | IDTVEC(trap00) | | 93 | IDTVEC(trap00) |
95 | ZTRAP(T_DIVIDE) | | 94 | ZTRAP(T_DIVIDE) |
96 | IDTVEC_END(trap00) | | 95 | IDTVEC_END(trap00) |
| | | 96 | |
97 | IDTVEC(trap01) | | 97 | IDTVEC(trap01) |
98 | BPTTRAP(T_TRCTRAP) | | 98 | BPTTRAP(T_TRCTRAP) |
99 | IDTVEC_END(trap01) | | 99 | IDTVEC_END(trap01) |
| | | 100 | |
100 | IDTVEC(trap02) | | 101 | IDTVEC(trap02) |
101 | pushl $0 | | 102 | pushl $0 |
102 | pushl $(T_NMI) | | 103 | pushl $(T_NMI) |
103 | INTRENTRY | | 104 | INTRENTRY |
104 | jmp _C_LABEL(calltrap) | | 105 | jmp _C_LABEL(calltrap) |
105 | IDTVEC_END(trap02) | | 106 | IDTVEC_END(trap02) |
| | | 107 | |
106 | IDTVEC(trap03) | | 108 | IDTVEC(trap03) |
107 | BPTTRAP(T_BPTFLT) | | 109 | BPTTRAP(T_BPTFLT) |
108 | IDTVEC_END(trap03) | | 110 | IDTVEC_END(trap03) |
| | | 111 | |
109 | IDTVEC(trap04) | | 112 | IDTVEC(trap04) |
110 | ZTRAP(T_OFLOW) | | 113 | ZTRAP(T_OFLOW) |
111 | IDTVEC_END(trap04) | | 114 | IDTVEC_END(trap04) |
| | | 115 | |
112 | IDTVEC(trap05) | | 116 | IDTVEC(trap05) |
113 | ZTRAP(T_BOUND) | | 117 | ZTRAP(T_BOUND) |
114 | IDTVEC_END(trap05) | | 118 | IDTVEC_END(trap05) |
| | | 119 | |
115 | /* | | 120 | /* |
116 | * Privileged instruction fault. | | 121 | * Privileged instruction fault. |
117 | */ | | 122 | */ |
118 | #ifdef KDTRACE_HOOKS | | 123 | #ifdef KDTRACE_HOOKS |
119 | SUPERALIGN_TEXT | | 124 | SUPERALIGN_TEXT |
120 | IDTVEC(trap06) | | 125 | IDTVEC(trap06) |
121 | /* Check if there is no DTrace hook registered. */ | | 126 | /* Check if there is no DTrace hook registered. */ |
122 | cmpl $0,dtrace_invop_jump_addr | | 127 | cmpl $0,dtrace_invop_jump_addr |
123 | je norm_ill | | 128 | je norm_ill |
124 | | | 129 | |
125 | /* Check if this is a user fault. */ | | 130 | /* Check if this is a user fault. */ |
126 | /* XXX this was 0x0020 in FreeBSD */ | | 131 | /* XXX this was 0x0020 in FreeBSD */ |
127 | cmpl $GSEL(GCODE_SEL, SEL_KPL), 4(%esp) /* Check code segment. */ | | 132 | cmpl $GSEL(GCODE_SEL, SEL_KPL),4(%esp) /* Check code segment. */ |
128 | | | 133 | |
129 | /* If so, just handle it as a normal trap. */ | | 134 | /* If so, just handle it as a normal trap. */ |
130 | jne norm_ill | | 135 | jne norm_ill |
131 | | | 136 | |
132 | /* | | 137 | /* |
133 | * This is a kernel instruction fault that might have been caused | | 138 | * This is a kernel instruction fault that might have been caused |
134 | * by a DTrace provider. | | 139 | * by a DTrace provider. |
135 | */ | | 140 | */ |
136 | | | 141 | |
137 | /* | | 142 | /* |
138 | * Set our jump address for the jump back in the event that | | 143 | * Set our jump address for the jump back in the event that |
139 | * the exception wasn't caused by DTrace at all. | | 144 | * the exception wasn't caused by DTrace at all. |
140 | */ | | 145 | */ |
141 | movl $norm_ill, dtrace_invop_calltrap_addr | | 146 | movl $norm_ill,dtrace_invop_calltrap_addr |
142 | | | 147 | |
143 | /* Jump to the code hooked in by DTrace. */ | | 148 | /* Jump to the code hooked in by DTrace. */ |
144 | jmpl *dtrace_invop_jump_addr | | 149 | jmpl *dtrace_invop_jump_addr |
145 | | | 150 | |
146 | /* | | 151 | /* |
147 | * Process the instruction fault in the normal way. | | 152 | * Process the instruction fault in the normal way. |
148 | */ | | 153 | */ |
149 | norm_ill: | | 154 | norm_ill: |
150 | ZTRAP(T_PRIVINFLT) | | 155 | ZTRAP(T_PRIVINFLT) |
151 | IDTVEC_END(trap06) | | 156 | IDTVEC_END(trap06) |
152 | #else | | 157 | #else |
153 | IDTVEC(trap06) | | 158 | IDTVEC(trap06) |
154 | ZTRAP(T_PRIVINFLT) | | 159 | ZTRAP(T_PRIVINFLT) |
155 | IDTVEC_END(trap06) | | 160 | IDTVEC_END(trap06) |
156 | #endif | | 161 | #endif |
| | | 162 | |
157 | IDTVEC(trap07) | | 163 | IDTVEC(trap07) |
158 | pushl $0 # dummy error code | | 164 | pushl $0 /* dummy error code */ |
159 | pushl $T_DNA | | 165 | pushl $T_DNA |
160 | INTRENTRY | | 166 | INTRENTRY |
161 | #ifdef DIAGNOSTIC | | 167 | #ifdef DIAGNOSTIC |
162 | movl CPUVAR(ILEVEL),%ebx | | 168 | movl CPUVAR(ILEVEL),%ebx |
163 | #endif | | 169 | #endif |
164 | pushl %esp | | 170 | pushl %esp |
165 | call _C_LABEL(fpudna) | | 171 | call _C_LABEL(fpudna) |
166 | addl $4,%esp | | 172 | addl $4,%esp |
167 | jmp _C_LABEL(trapreturn) | | 173 | jmp _C_LABEL(trapreturn) |
168 | IDTVEC_END(trap07) | | 174 | IDTVEC_END(trap07) |
| | | 175 | |
169 | IDTVEC(trap08) | | 176 | IDTVEC(trap08) |
170 | TRAP(T_DOUBLEFLT) | | 177 | TRAP(T_DOUBLEFLT) |
171 | IDTVEC_END(trap08) | | 178 | IDTVEC_END(trap08) |
| | | 179 | |
172 | IDTVEC(trap09) | | 180 | IDTVEC(trap09) |
173 | ZTRAP(T_FPOPFLT) | | 181 | ZTRAP(T_FPOPFLT) |
174 | IDTVEC_END(trap09) | | 182 | IDTVEC_END(trap09) |
| | | 183 | |
175 | IDTVEC(trap0a) | | 184 | IDTVEC(trap0a) |
176 | TRAP(T_TSSFLT) | | 185 | TRAP(T_TSSFLT) |
177 | IDTVEC_END(trap0a) | | 186 | IDTVEC_END(trap0a) |
| | | 187 | |
178 | IDTVEC(trap0b) | | 188 | IDTVEC(trap0b) |
179 | TRAP(T_SEGNPFLT) | | 189 | TRAP(T_SEGNPFLT) |
180 | IDTVEC_END(trap0b) | | 190 | IDTVEC_END(trap0b) |
| | | 191 | |
181 | IDTVEC(trap0c) | | 192 | IDTVEC(trap0c) |
182 | TRAP(T_STKFLT) | | 193 | TRAP(T_STKFLT) |
183 | IDTVEC_END(trap0c) | | 194 | IDTVEC_END(trap0c) |
| | | 195 | |
184 | IDTVEC(trap0d) | | 196 | IDTVEC(trap0d) |
185 | TRAP(T_PROTFLT) | | 197 | TRAP(T_PROTFLT) |
186 | IDTVEC_END(trap0d) | | 198 | IDTVEC_END(trap0d) |
| | | 199 | |
187 | IDTVEC(trap0e) | | 200 | IDTVEC(trap0e) |
188 | #ifndef XEN | | 201 | #ifndef XEN |
189 | pushl $T_PAGEFLT | | 202 | pushl $T_PAGEFLT |
190 | INTRENTRY | | 203 | INTRENTRY |
191 | STI(%eax) | | 204 | STI(%eax) |
192 | testb $PGEX_U,TF_ERR(%esp) | | 205 | testb $PGEX_U,TF_ERR(%esp) |
193 | jnz calltrap | | 206 | jnz calltrap |
194 | movl %cr2,%eax | | 207 | movl %cr2,%eax |
195 | subl _C_LABEL(pentium_idt),%eax | | 208 | subl _C_LABEL(pentium_idt),%eax |
196 | cmpl $(6*8),%eax | | 209 | cmpl $(6*8),%eax |
197 | jne calltrap | | 210 | jne calltrap |
198 | movb $T_PRIVINFLT,TF_TRAPNO(%esp) | | 211 | movb $T_PRIVINFLT,TF_TRAPNO(%esp) |
199 | jmp calltrap | | 212 | jmp calltrap |
200 | #else /* !XEN */ | | 213 | #else |
201 | TRAP(T_PAGEFLT) | | 214 | TRAP(T_PAGEFLT) |
202 | #endif /* !XEN */ | | 215 | #endif |
203 | IDTVEC_END(trap0e) | | 216 | IDTVEC_END(trap0e) |
204 | | | 217 | |
205 | IDTVEC(intrspurious) | | 218 | IDTVEC(intrspurious) |
206 | IDTVEC(trap0f) | | 219 | IDTVEC(trap0f) |
207 | /* | | 220 | /* |
208 | * The Pentium Pro local APIC may erroneously call this vector for a | | 221 | * The Pentium Pro local APIC may erroneously call this vector for a |
209 | * default IR7. Just ignore it. | | 222 | * default IR7. Just ignore it. |
210 | * | | 223 | * |
211 | * (The local APIC does this when CPL is raised while it's on the | | 224 | * (The local APIC does this when CPL is raised while it's on the |
212 | * way to delivering an interrupt.. presumably enough has been set | | 225 | * way to delivering an interrupt.. presumably enough has been set |
213 | * up that it's inconvenient to abort delivery completely..) | | 226 | * up that it's inconvenient to abort delivery completely..) |
214 | */ | | 227 | */ |
215 | pushl $0 # dummy error code | | 228 | pushl $0 /* dummy error code */ |
216 | pushl $T_ASTFLT | | 229 | pushl $T_ASTFLT |
217 | INTRENTRY | | 230 | INTRENTRY |
218 | STI(%eax) | | 231 | STI(%eax) |
219 | #ifdef DIAGNOSTIC | | 232 | #ifdef DIAGNOSTIC |
220 | movl CPUVAR(ILEVEL),%ebx | | 233 | movl CPUVAR(ILEVEL),%ebx |
221 | #endif | | 234 | #endif |
222 | jmp _C_LABEL(trapreturn) | | 235 | jmp _C_LABEL(trapreturn) |
223 | IDTVEC_END(trap0f) | | 236 | IDTVEC_END(trap0f) |
224 | IDTVEC_END(intrspurious) | | 237 | IDTVEC_END(intrspurious) |
225 | | | 238 | |
226 | IDTVEC(trap10) | | 239 | IDTVEC(trap10) |
227 | /* | | 240 | /* |
228 | * Handle like an interrupt so that we can call npxintr to clear the | | 241 | * Handle like an interrupt so that we can call npxintr to clear the |
229 | * error. It would be better to handle npx interrupts as traps but | | 242 | * error. It would be better to handle npx interrupts as traps but |
230 | * this is difficult for nested interrupts. | | 243 | * this is difficult for nested interrupts. |
231 | */ | | 244 | */ |
232 | pushl $0 # dummy error code | | 245 | pushl $0 /* dummy error code */ |
233 | pushl $T_ARITHTRAP | | 246 | pushl $T_ARITHTRAP |
234 | .Ldo_fputrap: | | 247 | .Ldo_fputrap: |
235 | INTRENTRY | | 248 | INTRENTRY |
236 | movl CPUVAR(ILEVEL),%ebx | | 249 | movl CPUVAR(ILEVEL),%ebx |
237 | pushl %esp | | 250 | pushl %esp |
238 | addl $1,CPUVAR(NTRAP) # statistical info | | 251 | addl $1,CPUVAR(NTRAP) /* statistical info */ |
239 | adcl $0,CPUVAR(NTRAP)+4 | | 252 | adcl $0,CPUVAR(NTRAP)+4 |
240 | call _C_LABEL(fputrap) | | 253 | call _C_LABEL(fputrap) |
241 | addl $4,%esp | | 254 | addl $4,%esp |
242 | jmp _C_LABEL(trapreturn) | | 255 | jmp _C_LABEL(trapreturn) |
243 | IDTVEC_END(trap10) | | 256 | IDTVEC_END(trap10) |
| | | 257 | |
244 | IDTVEC(trap11) | | 258 | IDTVEC(trap11) |
245 | TRAP(T_ALIGNFLT) | | 259 | TRAP(T_ALIGNFLT) |
246 | IDTVEC_END(trap11) | | 260 | IDTVEC_END(trap11) |
247 | | | 261 | |
248 | IDTVEC(trap12) | | 262 | IDTVEC(trap12) |
249 | ZTRAP(T_MCA) | | 263 | ZTRAP(T_MCA) |
250 | IDTVEC_END(trap12) | | 264 | IDTVEC_END(trap12) |
| | | 265 | |
251 | IDTVEC(trap13) | | 266 | IDTVEC(trap13) |
252 | pushl $0 # dummy error code | | 267 | pushl $0 /* dummy error code */ |
253 | pushl $T_XMM | | 268 | pushl $T_XMM |
254 | jmp .Ldo_fputrap | | 269 | jmp .Ldo_fputrap |
255 | IDTVEC_END(trap13) | | 270 | IDTVEC_END(trap13) |
256 | | | 271 | |
257 | IDTVEC(trap14) | | 272 | IDTVEC(trap14) |
258 | IDTVEC(trap15) | | 273 | IDTVEC(trap15) |
259 | IDTVEC(trap16) | | 274 | IDTVEC(trap16) |
260 | IDTVEC(trap17) | | 275 | IDTVEC(trap17) |
261 | IDTVEC(trap18) | | 276 | IDTVEC(trap18) |
262 | IDTVEC(trap19) | | 277 | IDTVEC(trap19) |
263 | IDTVEC(trap1a) | | 278 | IDTVEC(trap1a) |
264 | IDTVEC(trap1b) | | 279 | IDTVEC(trap1b) |
265 | IDTVEC(trap1c) | | 280 | IDTVEC(trap1c) |
| @@ -298,114 +313,114 @@ IDTVEC(exceptions) | | | @@ -298,114 +313,114 @@ IDTVEC(exceptions) |
298 | .long _C_LABEL(Xtrap0a), _C_LABEL(Xtrap0b) | | 313 | .long _C_LABEL(Xtrap0a), _C_LABEL(Xtrap0b) |
299 | .long _C_LABEL(Xtrap0c), _C_LABEL(Xtrap0d) | | 314 | .long _C_LABEL(Xtrap0c), _C_LABEL(Xtrap0d) |
300 | .long _C_LABEL(Xtrap0e), _C_LABEL(Xtrap0f) | | 315 | .long _C_LABEL(Xtrap0e), _C_LABEL(Xtrap0f) |
301 | .long _C_LABEL(Xtrap10), _C_LABEL(Xtrap11) | | 316 | .long _C_LABEL(Xtrap10), _C_LABEL(Xtrap11) |
302 | .long _C_LABEL(Xtrap12), _C_LABEL(Xtrap13) | | 317 | .long _C_LABEL(Xtrap12), _C_LABEL(Xtrap13) |
303 | .long _C_LABEL(Xtrap14), _C_LABEL(Xtrap15) | | 318 | .long _C_LABEL(Xtrap14), _C_LABEL(Xtrap15) |
304 | .long _C_LABEL(Xtrap16), _C_LABEL(Xtrap17) | | 319 | .long _C_LABEL(Xtrap16), _C_LABEL(Xtrap17) |
305 | .long _C_LABEL(Xtrap18), _C_LABEL(Xtrap19) | | 320 | .long _C_LABEL(Xtrap18), _C_LABEL(Xtrap19) |
306 | .long _C_LABEL(Xtrap1a), _C_LABEL(Xtrap1b) | | 321 | .long _C_LABEL(Xtrap1a), _C_LABEL(Xtrap1b) |
307 | .long _C_LABEL(Xtrap1c), _C_LABEL(Xtrap1d) | | 322 | .long _C_LABEL(Xtrap1c), _C_LABEL(Xtrap1d) |
308 | .long _C_LABEL(Xtrap1e), _C_LABEL(Xtrap1f) | | 323 | .long _C_LABEL(Xtrap1e), _C_LABEL(Xtrap1f) |
309 | IDTVEC_END(exceptions) | | 324 | IDTVEC_END(exceptions) |
310 | | | 325 | |
311 | | | 326 | |
312 | IDTVEC(tss_trap08) | | 327 | IDTVEC(tss_trap08) |
313 | 1: | | 328 | 1: |
314 | str %ax | | 329 | str %ax |
315 | GET_TSS | | 330 | GET_TSS |
316 | movzwl (%eax),%eax | | 331 | movzwl (%eax),%eax |
317 | GET_TSS | | 332 | GET_TSS |
318 | pushl $T_DOUBLEFLT | | 333 | pushl $T_DOUBLEFLT |
319 | pushl %eax | | 334 | pushl %eax |
320 | call _C_LABEL(trap_tss) | | 335 | call _C_LABEL(trap_tss) |
321 | addl $12,%esp | | 336 | addl $12,%esp |
322 | iret | | 337 | iret |
323 | jmp 1b | | 338 | jmp 1b |
324 | IDTVEC_END(tss_trap08) | | 339 | IDTVEC_END(tss_trap08) |
325 | | | 340 | |
326 | /* | | 341 | /* |
327 | * trap() calls here when it detects a fault in INTRFASTEXIT (loading the | | 342 | * trap() calls here when it detects a fault in INTRFASTEXIT (loading the |
328 | * segment registers or during the iret itself). | | 343 | * segment registers or during the iret itself). |
329 | * The address of the (possibly reconstructed) user trap frame is | | 344 | * The address of the (possibly reconstructed) user trap frame is |
330 | * passed as an argument. | | 345 | * passed as an argument. |
331 | * Typically the code will have raised a SIGSEGV which will be actioned | | 346 | * Typically the code will have raised a SIGSEGV which will be actioned |
332 | * by the code below. | | 347 | * by the code below. |
333 | */ | | 348 | */ |
334 | .type _C_LABEL(trap_return_fault_return), @function | | 349 | .type _C_LABEL(trap_return_fault_return),@function |
335 | LABEL(trap_return_fault_return) | | 350 | LABEL(trap_return_fault_return) |
336 | mov 4(%esp),%esp /* frame for user return */ | | 351 | mov 4(%esp),%esp /* frame for user return */ |
337 | jmp _C_LABEL(trapreturn) | | 352 | jmp _C_LABEL(trapreturn) |
338 | END(trap_return_fault_return) | | 353 | END(trap_return_fault_return) |
339 | | | 354 | |
340 | /* LINTSTUB: Ignore */ | | 355 | /* LINTSTUB: Ignore */ |
341 | NENTRY(alltraps) | | 356 | NENTRY(alltraps) |
342 | INTRENTRY | | 357 | INTRENTRY |
343 | STI(%eax) | | 358 | STI(%eax) |
344 | calltrap: | | 359 | calltrap: |
345 | #ifdef DIAGNOSTIC | | 360 | #ifdef DIAGNOSTIC |
346 | movl CPUVAR(ILEVEL),%ebx | | 361 | movl CPUVAR(ILEVEL),%ebx |
347 | #endif /* DIAGNOSTIC */ | | 362 | #endif |
348 | addl $1,CPUVAR(NTRAP) # statistical info | | 363 | addl $1,CPUVAR(NTRAP) /* statistical info */ |
349 | adcl $0,CPUVAR(NTRAP)+4 | | 364 | adcl $0,CPUVAR(NTRAP)+4 |
350 | pushl %esp | | 365 | pushl %esp |
351 | call _C_LABEL(trap) | | 366 | call _C_LABEL(trap) |
352 | addl $4,%esp | | 367 | addl $4,%esp |
353 | _C_LABEL(trapreturn): .globl trapreturn | | 368 | _C_LABEL(trapreturn): .globl trapreturn |
354 | testb $CHK_UPL,TF_CS(%esp) | | 369 | testb $CHK_UPL,TF_CS(%esp) |
355 | jnz .Lalltraps_checkast | | 370 | jnz .Lalltraps_checkast |
356 | #ifdef VM86 | | 371 | #ifdef VM86 |
357 | testl $PSL_VM,TF_EFLAGS(%esp) | | 372 | testl $PSL_VM,TF_EFLAGS(%esp) |
358 | jz 6f | | 373 | jz 6f |
359 | #else | | 374 | #else |
360 | jmp 6f | | 375 | jmp 6f |
361 | #endif | | 376 | #endif |
362 | .Lalltraps_checkast: | | 377 | .Lalltraps_checkast: |
363 | /* Check for ASTs on exit to user mode. */ | | 378 | /* Check for ASTs on exit to user mode. */ |
364 | CLI(%eax) | | 379 | CLI(%eax) |
365 | CHECK_ASTPENDING(%eax) | | 380 | CHECK_ASTPENDING(%eax) |
366 | jz 3f | | 381 | jz 3f |
367 | 5: CLEAR_ASTPENDING(%eax) | | 382 | 5: CLEAR_ASTPENDING(%eax) |
368 | STI(%eax) | | 383 | STI(%eax) |
369 | movl $T_ASTFLT,TF_TRAPNO(%esp) | | 384 | movl $T_ASTFLT,TF_TRAPNO(%esp) |
370 | addl $1,CPUVAR(NTRAP) # statistical info | | 385 | addl $1,CPUVAR(NTRAP) /* statistical info */ |
371 | adcl $0,CPUVAR(NTRAP)+4 | | 386 | adcl $0,CPUVAR(NTRAP)+4 |
372 | pushl %esp | | 387 | pushl %esp |
373 | call _C_LABEL(trap) | | 388 | call _C_LABEL(trap) |
374 | addl $4,%esp | | 389 | addl $4,%esp |
375 | jmp .Lalltraps_checkast /* re-check ASTs */ | | 390 | jmp .Lalltraps_checkast /* re-check ASTs */ |
376 | 3: CHECK_DEFERRED_SWITCH | | 391 | 3: CHECK_DEFERRED_SWITCH |
377 | jnz 9f | | 392 | jnz 9f |
378 | #ifdef XEN | | 393 | #ifdef XEN |
379 | STIC(%eax) | | 394 | STIC(%eax) |
380 | jz 6f | | 395 | jz 6f |
381 | call _C_LABEL(stipending) | | 396 | call _C_LABEL(stipending) |
382 | testl %eax,%eax | | 397 | testl %eax,%eax |
383 | jz 6f | | 398 | jz 6f |
384 | /* process pending interrupts */ | | 399 | /* process pending interrupts */ |
385 | CLI(%eax) | | 400 | CLI(%eax) |
386 | movl CPUVAR(ILEVEL), %ebx | | 401 | movl CPUVAR(ILEVEL),%ebx |
387 | movl $.Lalltraps_resume, %esi # address to resume loop at | | 402 | movl $.Lalltraps_resume,%esi /* address to resume loop at */ |
388 | .Lalltraps_resume: | | 403 | .Lalltraps_resume: |
389 | movl %ebx,%eax # get cpl | | 404 | movl %ebx,%eax /* get cpl */ |
390 | movl CPUVAR(IUNMASK)(,%eax,4),%eax | | 405 | movl CPUVAR(IUNMASK)(,%eax,4),%eax |
391 | andl CPUVAR(IPENDING),%eax # any non-masked bits left? | | 406 | andl CPUVAR(IPENDING),%eax /* any non-masked bits left? */ |
392 | jz 7f | | 407 | jz 7f |
393 | bsrl %eax,%eax | | 408 | bsrl %eax,%eax |
394 | btrl %eax,CPUVAR(IPENDING) | | 409 | btrl %eax,CPUVAR(IPENDING) |
395 | movl CPUVAR(ISOURCES)(,%eax,4),%eax | | 410 | movl CPUVAR(ISOURCES)(,%eax,4),%eax |
396 | jmp *IS_RESUME(%eax) | | 411 | jmp *IS_RESUME(%eax) |
397 | 7: movl %ebx, CPUVAR(ILEVEL) #restore cpl | | 412 | 7: movl %ebx,CPUVAR(ILEVEL) /* restore cpl */ |
398 | jmp _C_LABEL(trapreturn) | | 413 | jmp _C_LABEL(trapreturn) |
399 | #endif /* XEN */ | | 414 | #endif /* XEN */ |
400 | #ifndef DIAGNOSTIC | | 415 | #ifndef DIAGNOSTIC |
401 | 6: INTRFASTEXIT | | 416 | 6: INTRFASTEXIT |
402 | #else | | 417 | #else |
403 | 6: cmpl CPUVAR(ILEVEL),%ebx | | 418 | 6: cmpl CPUVAR(ILEVEL),%ebx |
404 | jne 3f | | 419 | jne 3f |
405 | INTRFASTEXIT | | 420 | INTRFASTEXIT |
406 | 3: STI(%eax) | | 421 | 3: STI(%eax) |
407 | pushl $4f | | 422 | pushl $4f |
408 | call _C_LABEL(panic) | | 423 | call _C_LABEL(panic) |
409 | addl $4,%esp | | 424 | addl $4,%esp |
410 | pushl %ebx | | 425 | pushl %ebx |
411 | call _C_LABEL(spllower) | | 426 | call _C_LABEL(spllower) |