0d7c815b541cfcb61b7050aeeea5656937ae6cd3
[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
9 struct exec_param;
10
11 struct regcontext
12 {
13     reg32 eax;
14     reg32 ebx;
15     reg32 ecx;
16     reg32 edx;
17     reg32 edi;
18     reg32 ebp;
19     reg32 esi;
20     reg32 ds;
21     reg32 es;
22     reg32 fs;
23     reg32 gs;
24 } __attribute__((packed));
25
26 typedef struct
27 {
28     unsigned int depth;
29     struct regcontext registers;
30     union
31     {
32         reg32 esp;
33         volatile struct exec_param* execp;
34     };
35 } __attribute__((packed)) isr_param;
36
37 struct exec_param
38 {
39     isr_param* saved_prev_ctx;
40     u32_t vector;
41     u32_t err_code;
42     u32_t eip;
43     u32_t cs;
44     u32_t eflags;
45     u32_t esp;
46     u32_t ss;
47 } __attribute__((packed));
48
49 #define ISR_PARAM_SIZE sizeof(isr_param)
50
51 void
52 intr_handler(isr_param* param);
53
54 void
55 intr_routine_init();
56
57 #endif
58
59 #endif /* __LUNAIX_INTERRUPTS_H */