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