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