Support to multi-threading and pthread interface (POSIX.1-2008) (#23)
[lunaix-os.git] / lunaix-os / arch / i386 / includes / sys / interrupts.h
index 003a2cd96bcda75b10933814b0a64ad40fe4227c..a13861004d3c4cb25d9d0fc7e129a4ad9b0178fe 100644 (file)
@@ -4,7 +4,11 @@
 #include "vectors.h"
 
 #ifndef __ASM__
 #include "vectors.h"
 
 #ifndef __ASM__
-#include <hal/cpu.h>
+#include <lunaix/compiler.h>
+#include <sys/cpu.h>
+
+#define saved_fp(isrm) ((isrm)->registers.ebp)
+#define kernel_context(isrm) (!(((isrm)->execp->cs) & 0b11))
 
 struct exec_param;
 
 
 struct exec_param;
 
@@ -21,9 +25,9 @@ struct regcontext
     u32_t es;
     u32_t fs;
     u32_t gs;
     u32_t es;
     u32_t fs;
     u32_t gs;
-} __attribute__((packed));
+} compact;
 
 
-typedef struct
+struct pcontext
 {
     unsigned int depth;
     struct regcontext registers;
 {
     unsigned int depth;
     struct regcontext registers;
@@ -32,11 +36,11 @@ typedef struct
         u32_t esp;
         volatile struct exec_param* execp;
     };
         u32_t esp;
         volatile struct exec_param* execp;
     };
-} __attribute__((packed)) isr_param;
+} compact;
 
 struct exec_param
 {
 
 struct exec_param
 {
-    isr_param* saved_prev_ctx;
+    struct pcontext* saved_prev_ctx;
     u32_t vector;
     u32_t err_code;
     u32_t eip;
     u32_t vector;
     u32_t err_code;
     u32_t eip;
@@ -44,12 +48,7 @@ struct exec_param
     u32_t eflags;
     u32_t esp;
     u32_t ss;
     u32_t eflags;
     u32_t esp;
     u32_t ss;
-} __attribute__((packed));
-
-#define ISR_PARAM_SIZE sizeof(isr_param)
-
-void
-exception_init();
+} compact;
 
 #endif
 
 
 #endif