Unifying the Lunaix's Physical Memory Model (#28)
[lunaix-os.git] / lunaix-os / arch / i386 / includes / sys / interrupts.h
index f1b7bf93aec373fde938947ba5eb9512600f3c42..540da4c219a6be7b8b4562b706b9e514a6f0f7df 100644 (file)
@@ -4,11 +4,9 @@
 #include "vectors.h"
 
 #ifndef __ASM__
+#include <lunaix/compiler.h>
 #include <sys/cpu.h>
 
-#define saved_fp(isrm) ((isrm)->registers.ebp)
-#define uspace_context(isrm) (((isrm)->execp->cs) == 0x8)
-
 struct exec_param;
 
 struct regcontext
@@ -24,9 +22,9 @@ struct regcontext
     u32_t es;
     u32_t fs;
     u32_t gs;
-} __attribute__((packed));
+} compact;
 
-typedef struct
+struct pcontext
 {
     unsigned int depth;
     struct regcontext registers;
@@ -35,11 +33,11 @@ typedef struct
         u32_t esp;
         volatile struct exec_param* execp;
     };
-} __attribute__((packed)) isr_param;
+} compact;
 
 struct exec_param
 {
-    isr_param* saved_prev_ctx;
+    struct pcontext* saved_prev_ctx;
     u32_t vector;
     u32_t err_code;
     u32_t eip;
@@ -47,12 +45,10 @@ struct exec_param
     u32_t eflags;
     u32_t esp;
     u32_t ss;
-} __attribute__((packed));
+} compact;
 
-#define ISR_PARAM_SIZE sizeof(isr_param)
-
-void
-exception_init();
+#define saved_fp(isrm) ((isrm)->registers.ebp)
+#define kernel_context(isrm) (!(((isrm)->execp->cs) & 0b11))
 
 #endif