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