]> git.saurik.com Git - apple/xnu.git/blob - osfmk/i386/idt.s
xnu-344.21.73.tar.gz
[apple/xnu.git] / osfmk / i386 / idt.s
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /*
26 * @OSF_COPYRIGHT@
27 */
28 /*
29 * Mach Operating System
30 * Copyright (c) 1991,1990 Carnegie Mellon University
31 * All Rights Reserved.
32 *
33 * Permission to use, copy, modify and distribute this software and its
34 * documentation is hereby granted, provided that both the copyright
35 * notice and this permission notice appear in all copies of the
36 * software, derivative works or modified versions, and any portions
37 * thereof, and that both notices appear in supporting documentation.
38 *
39 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
40 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
41 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
42 *
43 * Carnegie Mellon requests users of this software to return to
44 *
45 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
46 * School of Computer Science
47 * Carnegie Mellon University
48 * Pittsburgh PA 15213-3890
49 *
50 * any improvements or extensions that they make and grant Carnegie Mellon
51 * the rights to redistribute these changes.
52 */
53 /*
54 */
55 #include <i386/asm.h>
56 #include <assym.s>
57 #include <mach_kdb.h>
58
59 /*
60 * Interrupt descriptor table and code vectors for it.
61 */
62 #define IDT_BASE_ENTRY(vec,seg,type) \
63 .data ;\
64 .long vec ;\
65 .word seg ;\
66 .byte 0 ;\
67 .byte type ;\
68 .text
69
70 #define IDT_ENTRY(vec,type) IDT_BASE_ENTRY(vec,KERNEL_CS,type)
71
72 /*
73 * No error code. Clear error code and push trap number.
74 */
75 #define EXCEPTION(n,name) \
76 IDT_ENTRY(EXT(name),K_TRAP_GATE);\
77 Entry(name) ;\
78 pushl $0 ;\
79 pushl $(n) ;\
80 jmp EXT(alltraps)
81
82 /*
83 * Interrupt from user. Clear error code and push trap number.
84 */
85 #define EXCEP_USR(n,name) \
86 IDT_ENTRY(EXT(name),U_TRAP_GATE);\
87 Entry(name) ;\
88 pushl $0 ;\
89 pushl $(n) ;\
90 jmp EXT(alltraps)
91
92 /*
93 * Special interrupt code.
94 */
95 #define EXCEP_SPC(n,name) \
96 IDT_ENTRY(EXT(name),K_TRAP_GATE)
97
98 /*
99 * Special interrupt code from user.
100 */
101 #define EXCEP_SPC_USR(n,name) \
102 IDT_ENTRY(EXT(name),U_TRAP_GATE)
103
104 /*
105 * Extra-special interrupt code. Note that no offset may be
106 * specified in a task gate descriptor, so name is ignored.
107 */
108 #define EXCEP_TASK(n,name) \
109 IDT_BASE_ENTRY(0,DEBUG_TSS,K_TASK_GATE)
110
111 /*
112 * Error code has been pushed. Push trap number.
113 */
114 #define EXCEP_ERR(n,name) \
115 IDT_ENTRY(EXT(name),K_TRAP_GATE);\
116 Entry(name) ;\
117 pushl $(n) ;\
118 jmp EXT(alltraps)
119
120 /*
121 * Interrupt.
122 */
123 #define INTERRUPT(n) \
124 IDT_ENTRY(0f,K_INTR_GATE) ;\
125 0: ;\
126 pushl %eax ;\
127 movl $(n),%eax ;\
128 jmp EXT(all_intrs)
129
130 .data
131 Entry(idt)
132 .text
133
134 EXCEPTION(0x00,t_zero_div)
135 EXCEP_SPC(0x01,t_debug)
136 INTERRUPT(0x02) /* NMI */
137 EXCEP_USR(0x03,t_int3)
138 EXCEP_USR(0x04,t_into)
139 EXCEP_USR(0x05,t_bounds)
140 EXCEPTION(0x06,t_invop)
141 EXCEPTION(0x07,t_nofpu)
142 #if MACH_KDB
143 EXCEP_TASK(0x08,db_task_dbl_fault)
144 #else
145 EXCEPTION(0x08,a_dbl_fault)
146 #endif
147 EXCEPTION(0x09,a_fpu_over)
148 EXCEPTION(0x0a,a_inv_tss)
149 EXCEP_SPC(0x0b,t_segnp)
150 #if MACH_KDB
151 EXCEP_TASK(0x0c,db_task_stk_fault)
152 #else
153 EXCEP_ERR(0x0c,t_stack_fault)
154 #endif
155 EXCEP_SPC(0x0d,t_gen_prot)
156 EXCEP_SPC(0x0e,t_page_fault)
157 EXCEPTION(0x0f,t_trap_0f)
158 EXCEPTION(0x10,t_fpu_err)
159 EXCEPTION(0x11,t_trap_11)
160 EXCEPTION(0x12,t_trap_12)
161 EXCEPTION(0x13,t_trap_13)
162 EXCEPTION(0x14,t_trap_14)
163 EXCEPTION(0x15,t_trap_15)
164 EXCEPTION(0x16,t_trap_16)
165 EXCEPTION(0x17,t_trap_17)
166 EXCEPTION(0x18,t_trap_18)
167 EXCEPTION(0x19,t_trap_19)
168 EXCEPTION(0x1a,t_trap_1a)
169 EXCEPTION(0x1b,t_trap_1b)
170 EXCEPTION(0x1c,t_trap_1c)
171 EXCEPTION(0x1d,t_trap_1d)
172 EXCEPTION(0x1e,t_trap_1e)
173 EXCEPTION(0x1f,t_trap_1f)
174
175 INTERRUPT(0x20)
176 INTERRUPT(0x21)
177 INTERRUPT(0x22)
178 INTERRUPT(0x23)
179 INTERRUPT(0x24)
180 INTERRUPT(0x25)
181 INTERRUPT(0x26)
182 INTERRUPT(0x27)
183 INTERRUPT(0x28)
184 INTERRUPT(0x29)
185 INTERRUPT(0x2a)
186 INTERRUPT(0x2b)
187 INTERRUPT(0x2c)
188 INTERRUPT(0x2d)
189 INTERRUPT(0x2e)
190 INTERRUPT(0x2f)
191
192 INTERRUPT(0x30)
193 INTERRUPT(0x31)
194 INTERRUPT(0x32)
195 INTERRUPT(0x33)
196 INTERRUPT(0x34)
197 INTERRUPT(0x35)
198 INTERRUPT(0x36)
199 INTERRUPT(0x37)
200 INTERRUPT(0x38)
201 INTERRUPT(0x39)
202 INTERRUPT(0x3a)
203 INTERRUPT(0x3b)
204 INTERRUPT(0x3c)
205 INTERRUPT(0x3d)
206 INTERRUPT(0x3e)
207 INTERRUPT(0x3f)
208
209 INTERRUPT(0x40)
210 INTERRUPT(0x41)
211 INTERRUPT(0x42)
212 INTERRUPT(0x43)
213 INTERRUPT(0x44)
214 INTERRUPT(0x45)
215 INTERRUPT(0x46)
216 INTERRUPT(0x47)
217 INTERRUPT(0x48)
218 INTERRUPT(0x49)
219 INTERRUPT(0x4a)
220 INTERRUPT(0x4b)
221 INTERRUPT(0x4c)
222 INTERRUPT(0x4d)
223 INTERRUPT(0x4e)
224 INTERRUPT(0x4f)
225
226 INTERRUPT(0x50)
227 INTERRUPT(0x51)
228 INTERRUPT(0x52)
229 INTERRUPT(0x53)
230 INTERRUPT(0x54)
231 INTERRUPT(0x55)
232 INTERRUPT(0x56)
233 INTERRUPT(0x57)
234 INTERRUPT(0x58)
235 INTERRUPT(0x59)
236 INTERRUPT(0x5a)
237 INTERRUPT(0x5b)
238 INTERRUPT(0x5c)
239 INTERRUPT(0x5d)
240 INTERRUPT(0x5e)
241 INTERRUPT(0x5f)
242
243 INTERRUPT(0x60)
244 INTERRUPT(0x61)
245 INTERRUPT(0x62)
246 INTERRUPT(0x63)
247 INTERRUPT(0x64)
248 INTERRUPT(0x65)
249 INTERRUPT(0x66)
250 INTERRUPT(0x67)
251 INTERRUPT(0x68)
252 INTERRUPT(0x69)
253 INTERRUPT(0x6a)
254 INTERRUPT(0x6b)
255 INTERRUPT(0x6c)
256 INTERRUPT(0x6d)
257 INTERRUPT(0x6e)
258 INTERRUPT(0x6f)
259
260 INTERRUPT(0x70)
261 INTERRUPT(0x71)
262 INTERRUPT(0x72)
263 INTERRUPT(0x73)
264 INTERRUPT(0x74)
265 INTERRUPT(0x75)
266 INTERRUPT(0x76)
267 INTERRUPT(0x77)
268 INTERRUPT(0x78)
269 INTERRUPT(0x79)
270 INTERRUPT(0x7a)
271 INTERRUPT(0x7b)
272 INTERRUPT(0x7c)
273 INTERRUPT(0x7d)
274 INTERRUPT(0x7e)
275 INTERRUPT(0x7f)
276
277 EXCEP_SPC_USR(0x80,syscall_int80)
278 INTERRUPT(0x81)
279 INTERRUPT(0x82)
280 INTERRUPT(0x83)
281 INTERRUPT(0x84)
282 INTERRUPT(0x85)
283 INTERRUPT(0x86)
284 INTERRUPT(0x87)
285 INTERRUPT(0x88)
286 INTERRUPT(0x89)
287 INTERRUPT(0x8a)
288 INTERRUPT(0x8b)
289 INTERRUPT(0x8c)
290 INTERRUPT(0x8d)
291 INTERRUPT(0x8e)
292 INTERRUPT(0x8f)
293
294 INTERRUPT(0x90)
295 INTERRUPT(0x91)
296 INTERRUPT(0x92)
297 INTERRUPT(0x93)
298 INTERRUPT(0x94)
299 INTERRUPT(0x95)
300 INTERRUPT(0x96)
301 INTERRUPT(0x97)
302 INTERRUPT(0x98)
303 INTERRUPT(0x99)
304 INTERRUPT(0x9a)
305 INTERRUPT(0x9b)
306 INTERRUPT(0x9c)
307 INTERRUPT(0x9d)
308 INTERRUPT(0x9e)
309 INTERRUPT(0x9f)
310
311 INTERRUPT(0xa0)
312 INTERRUPT(0xa1)
313 INTERRUPT(0xa2)
314 INTERRUPT(0xa3)
315 INTERRUPT(0xa4)
316 INTERRUPT(0xa5)
317 INTERRUPT(0xa6)
318 INTERRUPT(0xa7)
319 INTERRUPT(0xa8)
320 INTERRUPT(0xa9)
321 INTERRUPT(0xaa)
322 INTERRUPT(0xab)
323 INTERRUPT(0xac)
324 INTERRUPT(0xad)
325 INTERRUPT(0xae)
326 INTERRUPT(0xaf)
327
328 INTERRUPT(0xb0)
329 INTERRUPT(0xb1)
330 INTERRUPT(0xb2)
331 INTERRUPT(0xb3)
332 INTERRUPT(0xb4)
333 INTERRUPT(0xb5)
334 INTERRUPT(0xb6)
335 INTERRUPT(0xb7)
336 INTERRUPT(0xb8)
337 INTERRUPT(0xb9)
338 INTERRUPT(0xba)
339 INTERRUPT(0xbb)
340 INTERRUPT(0xbc)
341 INTERRUPT(0xbd)
342 INTERRUPT(0xbe)
343 INTERRUPT(0xbf)
344
345 INTERRUPT(0xc0)
346 INTERRUPT(0xc1)
347 INTERRUPT(0xc2)
348 INTERRUPT(0xc3)
349 INTERRUPT(0xc4)
350 INTERRUPT(0xc5)
351 INTERRUPT(0xc6)
352 INTERRUPT(0xc7)
353 INTERRUPT(0xc8)
354 INTERRUPT(0xc9)
355 INTERRUPT(0xca)
356 INTERRUPT(0xcb)
357 INTERRUPT(0xcc)
358 INTERRUPT(0xcd)
359 INTERRUPT(0xce)
360 INTERRUPT(0xcf)
361
362 INTERRUPT(0xd0)
363 INTERRUPT(0xd1)
364 INTERRUPT(0xd2)
365 INTERRUPT(0xd3)
366 INTERRUPT(0xd4)
367 INTERRUPT(0xd5)
368 INTERRUPT(0xd6)
369 INTERRUPT(0xd7)
370 INTERRUPT(0xd8)
371 INTERRUPT(0xd9)
372 INTERRUPT(0xda)
373 INTERRUPT(0xdb)
374 INTERRUPT(0xdc)
375 INTERRUPT(0xdd)
376 INTERRUPT(0xde)
377 INTERRUPT(0xdf)
378
379 INTERRUPT(0xe0)
380 INTERRUPT(0xe1)
381 INTERRUPT(0xe2)
382 INTERRUPT(0xe3)
383 INTERRUPT(0xe4)
384 INTERRUPT(0xe5)
385 INTERRUPT(0xe6)
386 INTERRUPT(0xe7)
387 INTERRUPT(0xe8)
388 INTERRUPT(0xe9)
389 INTERRUPT(0xea)
390 INTERRUPT(0xeb)
391 INTERRUPT(0xec)
392 INTERRUPT(0xed)
393 INTERRUPT(0xee)
394 INTERRUPT(0xef)
395
396 INTERRUPT(0xf0)
397 INTERRUPT(0xf1)
398 INTERRUPT(0xf2)
399 INTERRUPT(0xf3)
400 INTERRUPT(0xf4)
401 INTERRUPT(0xf5)
402 INTERRUPT(0xf6)
403 INTERRUPT(0xf7)
404 INTERRUPT(0xf8)
405 INTERRUPT(0xf9)
406 INTERRUPT(0xfa)
407 INTERRUPT(0xfb)
408 INTERRUPT(0xfc)
409 INTERRUPT(0xfd)
410 INTERRUPT(0xfe)
411 EXCEPTION(0xff,t_preempt)
412