basic process support and some syscalls
[lunaix-os.git] / lunaix-os / includes / arch / x86 / interrupts.h
1 #ifndef __LUNAIX_INTERRUPTS_H
2 #define __LUNAIX_INTERRUPTS_H
3
4 #include "vectors.h"
5
6 #ifndef __ASM__
7 #include <hal/cpu.h>
8 typedef struct {
9     gp_regs registers;
10     unsigned int vector;
11     unsigned int err_code;
12     unsigned int eip;
13     unsigned int cs;
14     unsigned int eflags;
15     unsigned int esp;
16     unsigned int ss;
17 } __attribute__((packed)) isr_param;
18
19 typedef void (*int_subscriber)(isr_param*);
20
21 #pragma region ISR_DECLARATION
22
23 #define ISR(iv) void _asm_isr##iv();
24
25 ISR(0)
26 ISR(1)
27 ISR(2)
28 ISR(3)
29 ISR(4)
30 ISR(5)
31 ISR(6)
32 ISR(7)
33 ISR(8)
34 ISR(9)
35 ISR(10)
36 ISR(11)
37 ISR(12)
38 ISR(13)
39 ISR(14)
40 ISR(15)
41 ISR(16)
42 ISR(17)
43 ISR(18)
44 ISR(19)
45 ISR(20)
46 ISR(21)
47
48 ISR(32)
49 ISR(33)
50
51 ISR(201)
52
53 ISR(210)
54
55 ISR(250)
56 ISR(251)
57 ISR(252)
58 ISR(253)
59 ISR(254)
60
61 #pragma endregion
62
63 void
64 intr_subscribe(const uint8_t vector, int_subscriber);
65
66 void
67 intr_unsubscribe(const uint8_t vector, int_subscriber);
68
69 void
70 intr_set_fallback_handler(int_subscriber);
71
72 void
73 intr_handler(isr_param* param);
74
75 void
76 intr_routine_init();
77
78 #endif
79
80 #endif /* __LUNAIX_INTERRUPTS_H */