]> git.saurik.com Git - apple/xnu.git/blame - osfmk/i386/idt.s
xnu-123.5.tar.gz
[apple/xnu.git] / osfmk / i386 / idt.s
CommitLineData
1c79356b
A
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);\
74Entry(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);\
84Entry(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);\
113Entry(name) ;\
114 pushl $(n) ;\
115 jmp EXT(alltraps)
116
117/*
118 * Interrupt.
119 */
120#define INTERRUPT(n) \
121 IDT_ENTRY(0f,K_INTR_GATE) ;\
1220: ;\
123 pushl %eax ;\
124 movl $(n),%eax ;\
125 jmp EXT(all_intrs)
126
127 .data
128Entry(idt)
129 .text
130
131EXCEPTION(0x00,t_zero_div)
132EXCEP_SPC(0x01,t_debug)
133INTERRUPT(0x02) /* NMI */
134EXCEP_USR(0x03,t_int3)
135EXCEP_USR(0x04,t_into)
136EXCEP_USR(0x05,t_bounds)
137EXCEPTION(0x06,t_invop)
138EXCEPTION(0x07,t_nofpu)
139#if MACH_KDB
140EXCEP_TASK(0x08,db_task_dbl_fault)
141#else
142EXCEPTION(0x08,a_dbl_fault)
143#endif
144EXCEPTION(0x09,a_fpu_over)
145EXCEPTION(0x0a,a_inv_tss)
146EXCEP_SPC(0x0b,t_segnp)
147#if MACH_KDB
148EXCEP_TASK(0x0c,db_task_stk_fault)
149#else
150EXCEP_ERR(0x0c,t_stack_fault)
151#endif
152EXCEP_SPC(0x0d,t_gen_prot)
153EXCEP_SPC(0x0e,t_page_fault)
154EXCEPTION(0x0f,t_trap_0f)
155EXCEPTION(0x10,t_fpu_err)
156EXCEPTION(0x11,t_trap_11)
157EXCEPTION(0x12,t_trap_12)
158EXCEPTION(0x13,t_trap_13)
159EXCEPTION(0x14,t_trap_14)
160EXCEPTION(0x15,t_trap_15)
161EXCEPTION(0x16,t_trap_16)
162EXCEPTION(0x17,t_trap_17)
163EXCEPTION(0x18,t_trap_18)
164EXCEPTION(0x19,t_trap_19)
165EXCEPTION(0x1a,t_trap_1a)
166EXCEPTION(0x1b,t_trap_1b)
167EXCEPTION(0x1c,t_trap_1c)
168EXCEPTION(0x1d,t_trap_1d)
169EXCEPTION(0x1e,t_trap_1e)
170EXCEPTION(0x1f,t_trap_1f)
171
172INTERRUPT(0x20)
173INTERRUPT(0x21)
174INTERRUPT(0x22)
175INTERRUPT(0x23)
176INTERRUPT(0x24)
177INTERRUPT(0x25)
178INTERRUPT(0x26)
179INTERRUPT(0x27)
180INTERRUPT(0x28)
181INTERRUPT(0x29)
182INTERRUPT(0x2a)
183INTERRUPT(0x2b)
184INTERRUPT(0x2c)
185INTERRUPT(0x2d)
186INTERRUPT(0x2e)
187INTERRUPT(0x2f)
188
189INTERRUPT(0x30)
190INTERRUPT(0x31)
191INTERRUPT(0x32)
192INTERRUPT(0x33)
193INTERRUPT(0x34)
194INTERRUPT(0x35)
195INTERRUPT(0x36)
196INTERRUPT(0x37)
197INTERRUPT(0x38)
198INTERRUPT(0x39)
199INTERRUPT(0x3a)
200INTERRUPT(0x3b)
201INTERRUPT(0x3c)
202INTERRUPT(0x3d)
203INTERRUPT(0x3e)
204INTERRUPT(0x3f)
205
206INTERRUPT(0x40)
207INTERRUPT(0x41)
208INTERRUPT(0x42)
209INTERRUPT(0x43)
210INTERRUPT(0x44)
211INTERRUPT(0x45)
212INTERRUPT(0x46)
213INTERRUPT(0x47)
214INTERRUPT(0x48)
215INTERRUPT(0x49)
216INTERRUPT(0x4a)
217INTERRUPT(0x4b)
218INTERRUPT(0x4c)
219INTERRUPT(0x4d)
220INTERRUPT(0x4e)
221INTERRUPT(0x4f)
222
223INTERRUPT(0x50)
224INTERRUPT(0x51)
225INTERRUPT(0x52)
226INTERRUPT(0x53)
227INTERRUPT(0x54)
228INTERRUPT(0x55)
229INTERRUPT(0x56)
230INTERRUPT(0x57)
231INTERRUPT(0x58)
232INTERRUPT(0x59)
233INTERRUPT(0x5a)
234INTERRUPT(0x5b)
235INTERRUPT(0x5c)
236INTERRUPT(0x5d)
237INTERRUPT(0x5e)
238INTERRUPT(0x5f)
239
240INTERRUPT(0x60)
241INTERRUPT(0x61)
242INTERRUPT(0x62)
243INTERRUPT(0x63)
244INTERRUPT(0x64)
245INTERRUPT(0x65)
246INTERRUPT(0x66)
247INTERRUPT(0x67)
248INTERRUPT(0x68)
249INTERRUPT(0x69)
250INTERRUPT(0x6a)
251INTERRUPT(0x6b)
252INTERRUPT(0x6c)
253INTERRUPT(0x6d)
254INTERRUPT(0x6e)
255INTERRUPT(0x6f)
256
257INTERRUPT(0x70)
258INTERRUPT(0x71)
259INTERRUPT(0x72)
260INTERRUPT(0x73)
261INTERRUPT(0x74)
262INTERRUPT(0x75)
263INTERRUPT(0x76)
264INTERRUPT(0x77)
265INTERRUPT(0x78)
266INTERRUPT(0x79)
267INTERRUPT(0x7a)
268INTERRUPT(0x7b)
269INTERRUPT(0x7c)
270INTERRUPT(0x7d)
271INTERRUPT(0x7e)
272INTERRUPT(0x7f)
273
274EXCEP_SPC_USR(0x80,syscall_int80)
275INTERRUPT(0x81)
276INTERRUPT(0x82)
277INTERRUPT(0x83)
278INTERRUPT(0x84)
279INTERRUPT(0x85)
280INTERRUPT(0x86)
281INTERRUPT(0x87)
282INTERRUPT(0x88)
283INTERRUPT(0x89)
284INTERRUPT(0x8a)
285INTERRUPT(0x8b)
286INTERRUPT(0x8c)
287INTERRUPT(0x8d)
288INTERRUPT(0x8e)
289INTERRUPT(0x8f)
290
291INTERRUPT(0x90)
292INTERRUPT(0x91)
293INTERRUPT(0x92)
294INTERRUPT(0x93)
295INTERRUPT(0x94)
296INTERRUPT(0x95)
297INTERRUPT(0x96)
298INTERRUPT(0x97)
299INTERRUPT(0x98)
300INTERRUPT(0x99)
301INTERRUPT(0x9a)
302INTERRUPT(0x9b)
303INTERRUPT(0x9c)
304INTERRUPT(0x9d)
305INTERRUPT(0x9e)
306INTERRUPT(0x9f)
307
308INTERRUPT(0xa0)
309INTERRUPT(0xa1)
310INTERRUPT(0xa2)
311INTERRUPT(0xa3)
312INTERRUPT(0xa4)
313INTERRUPT(0xa5)
314INTERRUPT(0xa6)
315INTERRUPT(0xa7)
316INTERRUPT(0xa8)
317INTERRUPT(0xa9)
318INTERRUPT(0xaa)
319INTERRUPT(0xab)
320INTERRUPT(0xac)
321INTERRUPT(0xad)
322INTERRUPT(0xae)
323INTERRUPT(0xaf)
324
325INTERRUPT(0xb0)
326INTERRUPT(0xb1)
327INTERRUPT(0xb2)
328INTERRUPT(0xb3)
329INTERRUPT(0xb4)
330INTERRUPT(0xb5)
331INTERRUPT(0xb6)
332INTERRUPT(0xb7)
333INTERRUPT(0xb8)
334INTERRUPT(0xb9)
335INTERRUPT(0xba)
336INTERRUPT(0xbb)
337INTERRUPT(0xbc)
338INTERRUPT(0xbd)
339INTERRUPT(0xbe)
340INTERRUPT(0xbf)
341
342INTERRUPT(0xc0)
343INTERRUPT(0xc1)
344INTERRUPT(0xc2)
345INTERRUPT(0xc3)
346INTERRUPT(0xc4)
347INTERRUPT(0xc5)
348INTERRUPT(0xc6)
349INTERRUPT(0xc7)
350INTERRUPT(0xc8)
351INTERRUPT(0xc9)
352INTERRUPT(0xca)
353INTERRUPT(0xcb)
354INTERRUPT(0xcc)
355INTERRUPT(0xcd)
356INTERRUPT(0xce)
357INTERRUPT(0xcf)
358
359INTERRUPT(0xd0)
360INTERRUPT(0xd1)
361INTERRUPT(0xd2)
362INTERRUPT(0xd3)
363INTERRUPT(0xd4)
364INTERRUPT(0xd5)
365INTERRUPT(0xd6)
366INTERRUPT(0xd7)
367INTERRUPT(0xd8)
368INTERRUPT(0xd9)
369INTERRUPT(0xda)
370INTERRUPT(0xdb)
371INTERRUPT(0xdc)
372INTERRUPT(0xdd)
373INTERRUPT(0xde)
374INTERRUPT(0xdf)
375
376INTERRUPT(0xe0)
377INTERRUPT(0xe1)
378INTERRUPT(0xe2)
379INTERRUPT(0xe3)
380INTERRUPT(0xe4)
381INTERRUPT(0xe5)
382INTERRUPT(0xe6)
383INTERRUPT(0xe7)
384INTERRUPT(0xe8)
385INTERRUPT(0xe9)
386INTERRUPT(0xea)
387INTERRUPT(0xeb)
388INTERRUPT(0xec)
389INTERRUPT(0xed)
390INTERRUPT(0xee)
391INTERRUPT(0xef)
392
393INTERRUPT(0xf0)
394INTERRUPT(0xf1)
395INTERRUPT(0xf2)
396INTERRUPT(0xf3)
397INTERRUPT(0xf4)
398INTERRUPT(0xf5)
399INTERRUPT(0xf6)
400INTERRUPT(0xf7)
401INTERRUPT(0xf8)
402INTERRUPT(0xf9)
403INTERRUPT(0xfa)
404INTERRUPT(0xfb)
405INTERRUPT(0xfc)
406INTERRUPT(0xfd)
407INTERRUPT(0xfe)
408EXCEPTION(0xff,t_preempt)
409