2 meinOS - A unix-like x86 microkernel operating system
3 Copyright (C) 2008 Janosch Gräf <janosch.graef@gmx.net>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 #define INTERRUPT_EXCEPTION_DIVIDE_ERROR 0x00
27 #define INTERRUPT_EXCEPTION_DEBUG_EXCEPTION 0x01
28 #define INTERRUPT_EXCEPTION_BREAKPOINT 0x03
29 #define INTERRUPT_EXCEPTION_OVERFLOW 0x04
30 #define INTERRUPT_EXCEPTION_BOUNDS_CHECK 0x05
31 #define INTERRUPT_EXCEPTION_INVALID_OPCODE 0x06
32 #define INTERRUPT_EXCEPTION_COPROCESSOR_NA 0x07
33 #define INTERRUPT_EXCEPTION_DOUBLE_FAULT 0x08
34 #define INTERRUPT_EXCEPTION_COPROCESSOR_SO 0x09
35 #define INTERRUPT_EXCEPTION_INVALID_TSS 0x0A
36 #define INTERRUPT_EXCEPTION_SEGMENT_NP 0x0B
37 #define INTERRUPT_EXCEPTION_STACK_EXCEPTION 0x0C
38 #define INTERRUPT_EXCEPTION_GPF 0x0D
39 #define INTERRUPT_EXCEPTION_PAGE_FAULT 0x0E
40 #define INTERRUPT_EXCEPTION_COPROCESSOR_ERROR 0x10
42 typedef struct interrupt_sleep_S interrupt_sleep_t
;
44 struct interrupt_sleep_S
{
45 enum { TIME_SLEEP
, TIME_HANDLER
} type
;
46 unsigned long long usec
;
51 enum { IRQ_SLEEP
, IRQ_HANDLER
} type
;
56 struct cpu_registers interrupt_curregs
;
58 llist_t interrupt_sleep
;
59 int interrupt_enabled
;
60 llist_t interrupt_irq
[16];
63 void interrupt_handler(unsigned int interrupt
,uint32_t *stack
);
64 void interrupt_lapic_handler(unsigned int interrupt
);
65 void interrupt_irq_handler(unsigned int irq
);
66 void interrupt_exception_handler(unsigned int exception
,uint32_t errcode
);
67 void interrupt_enable(int enable
);
68 int interrupt_irq_reghandler(unsigned int irq
,void *func
);
69 int interrupt_irq_sleep(unsigned int irq
);
70 void interrupt_irq_check(unsigned int irq
);
71 int interrupt_time_sleep(unsigned int sec
);
72 int interrupt_time_usleep(unsigned int usec
);
73 void interrupt_time_check(unsigned int usec
);
74 clock_t interrupt_time_getticks();
75 uint32_t *interrupt_save_stack(uint32_t *stack
,uint32_t *errorcode
);