Begin task refactor
Store state using interrupt stack instead. Looks like `int 0x80` doesn't
work though, which is odd.
diff --git a/src/kernel/faults.c b/src/kernel/faults.c
new file mode 100644
index 0000000..ba5a615
--- /dev/null
+++ b/src/kernel/faults.c
@@ -0,0 +1,22 @@
+#include "pic.h"
+#include <log.h>
+
+#define DECLARE_INTERRUPT(sym, name) \
+ static void sym##_h(struct registers *regs) \
+ { \
+ kprintf("Fault " name ": eip = 0x%x, err = 0x%x\n", regs->eip, \
+ regs->error_code); \
+ asm volatile("cli"); \
+ kpanic(name); \
+ }
+
+#define ADD_INTERRUPT(sym, num) add_interrupt_handler(num, sym##_h)
+
+DECLARE_INTERRUPT(gp, "#GP")
+DECLARE_INTERRUPT(pf, "#PF")
+
+void init_faults()
+{
+ ADD_INTERRUPT(gp, 13);
+ ADD_INTERRUPT(pf, 14);
+}