refactor: striped more arch-related code from the kernel code base
[lunaix-os.git] / lunaix-os / arch / i386 / includes / sys / 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     u32_t eax;
14     u32_t ebx;
15     u32_t ecx;
16     u32_t edx;
17     u32_t edi;
18     u32_t ebp;
19     u32_t esi;
20     u32_t ds;
21     u32_t es;
22     u32_t fs;
23     u32_t gs;
24 } __attribute__((packed));
25
26 typedef struct
27 {
28     unsigned int depth;
29     struct regcontext registers;
30     union
31     {
32         u32_t 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 exception_init();
53
54 #endif
55
56 #endif /* __LUNAIX_INTERRUPTS_H */