540da4c219a6be7b8b4562b706b9e514a6f0f7df
[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 <lunaix/compiler.h>
8 #include <sys/cpu.h>
9
10 struct exec_param;
11
12 struct regcontext
13 {
14     u32_t eax;
15     u32_t ebx;
16     u32_t ecx;
17     u32_t edx;
18     u32_t edi;
19     u32_t ebp;
20     u32_t esi;
21     u32_t ds;
22     u32_t es;
23     u32_t fs;
24     u32_t gs;
25 } compact;
26
27 struct pcontext
28 {
29     unsigned int depth;
30     struct regcontext registers;
31     union
32     {
33         u32_t esp;
34         volatile struct exec_param* execp;
35     };
36 } compact;
37
38 struct exec_param
39 {
40     struct pcontext* saved_prev_ctx;
41     u32_t vector;
42     u32_t err_code;
43     u32_t eip;
44     u32_t cs;
45     u32_t eflags;
46     u32_t esp;
47     u32_t ss;
48 } compact;
49
50 #define saved_fp(isrm) ((isrm)->registers.ebp)
51 #define kernel_context(isrm) (!(((isrm)->execp->cs) & 0b11))
52
53 #endif
54
55 #endif /* __LUNAIX_INTERRUPTS_H */