aboutsummaryrefslogtreecommitdiff
path: root/arch/i386/isr.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/isr.c')
-rw-r--r--arch/i386/isr.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/arch/i386/isr.c b/arch/i386/isr.c
new file mode 100644
index 0000000..acc2961
--- /dev/null
+++ b/arch/i386/isr.c
@@ -0,0 +1,50 @@
+/*
+ * Interrupt Service Routines
+ */
+
+#include "idt.h"
+#include "sys/control.h"
+#include <stdio.h>
+
+__attribute__((interrupt)) void
+abort_handler(struct interrupt_frame *frame)
+{
+ printf("### system abort ###\n");
+ printf("# ip: %x cs=%x\n", frame->ip, frame->cs);
+ printf("# sp: %x ss=%x\n", frame->sp, frame->ss);
+ printf("# flags: %x\n", frame->flags);
+ abort();
+}
+
+__attribute__((interrupt)) void
+syscall_handler(__attribute__((unused)) struct interrupt_frame *frame)
+{
+ unsigned int n;
+ __asm__("mov %%eax, %0" : "=r"(n));
+ printf("syscall %x\n, n");
+ abort();
+}
+
+void pic_clear(unsigned char irq);
+
+__attribute__((interrupt)) void
+irq0x00(__attribute__((unused)) struct interrupt_frame *frame)
+{
+ pic_clear(0x00);
+}
+
+extern void ps2_keyboard_irq_handler();
+__attribute__((interrupt)) void
+irq0x01(__attribute__((unused)) struct interrupt_frame *frame)
+{
+ ps2_keyboard_irq_handler();
+ pic_clear(0x01);
+}
+
+extern void mouse_packet();
+__attribute__((interrupt)) void
+irq0x0c(__attribute__((unused)) struct interrupt_frame *frame)
+{
+ mouse_packet();
+ pic_clear(0x0c);
+}