xref: /haiku/src/system/boot/platform/bios_ia32/interrupts.h (revision 3dfd9cb95ce45f59160d50975210bc55e3fc0709)
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 void interrupts_init_kernel_idt(void* idt, size_t idtSize);
30 
31 
32 __END_DECLS
33 
34 
35 #endif	// _ASSEMBLER
36 
37 #define INTERRUPT_FUNCTION_ERROR(vector)	INTERRUPT_FUNCTION(vector)
38 
39 #define INTERRUPT_FUNCTIONS5(vector1, vector2, vector3, vector4, vector5)	\
40 	INTERRUPT_FUNCTION(vector1)												\
41 	INTERRUPT_FUNCTION(vector2)												\
42 	INTERRUPT_FUNCTION(vector3)												\
43 	INTERRUPT_FUNCTION(vector4)												\
44 	INTERRUPT_FUNCTION(vector5)
45 
46 #define INTERRUPT_FUNCTIONS()				\
47 	INTERRUPT_FUNCTIONS5(0, 1, 2, 3, 4)		\
48 	INTERRUPT_FUNCTIONS5(5, 6, 7, 8, 9)		\
49 	INTERRUPT_FUNCTION_ERROR(10)			\
50 	INTERRUPT_FUNCTION_ERROR(11)			\
51 	INTERRUPT_FUNCTION_ERROR(12)			\
52 	INTERRUPT_FUNCTION_ERROR(13)			\
53 	INTERRUPT_FUNCTION_ERROR(14)			\
54 	INTERRUPT_FUNCTION(15)					\
55 	INTERRUPT_FUNCTION(16)					\
56 	INTERRUPT_FUNCTION_ERROR(17)			\
57 	INTERRUPT_FUNCTION(18)					\
58 	INTERRUPT_FUNCTION(19)
59 
60 #define DEBUG_IDT_SLOT_COUNT	20
61 
62 
63 #endif	// INTERRUPTS_H
64