xref: /haiku/src/system/boot/platform/bios_ia32/interrupts.h (revision 68ea01249e1e2088933cb12f9c28d4e5c5d1c9ef)
1 /*
2  * Copyright 2011, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef INTERRUPTS_H
6 #define INTERRUPTS_H
7 
8 
9 #ifndef _ASSEMBLER
10 
11 
12 #include <sys/cdefs.h>
13 
14 #include <SupportDefs.h>
15 
16 
17 struct gdt_idt_descr {
18 	uint16	limit;
19 	void*	base;
20 } _PACKED;
21 
22 
23 __BEGIN_DECLS
24 
25 
26 void interrupts_init();
27 void set_debug_idt();
28 void restore_bios_idt();
29 
30 
31 __END_DECLS
32 
33 
34 #endif	// _ASSEMBLER
35 
36 #define INTERRUPT_FUNCTION_ERROR(vector)	INTERRUPT_FUNCTION(vector)
37 
38 #define INTERRUPT_FUNCTIONS5(vector1, vector2, vector3, vector4, vector5)	\
39 	INTERRUPT_FUNCTION(vector1)												\
40 	INTERRUPT_FUNCTION(vector2)												\
41 	INTERRUPT_FUNCTION(vector3)												\
42 	INTERRUPT_FUNCTION(vector4)												\
43 	INTERRUPT_FUNCTION(vector5)
44 
45 #define INTERRUPT_FUNCTIONS()				\
46 	INTERRUPT_FUNCTIONS5(0, 1, 2, 3, 4)		\
47 	INTERRUPT_FUNCTIONS5(5, 6, 7, 8, 9)		\
48 	INTERRUPT_FUNCTION_ERROR(10)			\
49 	INTERRUPT_FUNCTION_ERROR(11)			\
50 	INTERRUPT_FUNCTION_ERROR(12)			\
51 	INTERRUPT_FUNCTION_ERROR(13)			\
52 	INTERRUPT_FUNCTION_ERROR(14)			\
53 	INTERRUPT_FUNCTION(15)					\
54 	INTERRUPT_FUNCTION(16)					\
55 	INTERRUPT_FUNCTION_ERROR(17)			\
56 	INTERRUPT_FUNCTION(18)					\
57 	INTERRUPT_FUNCTION(19)
58 
59 #define DEBUG_IDT_SLOT_COUNT	20
60 
61 
62 #endif	// INTERRUPTS_H
63