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