|
|
@@ -40,26 +40,27 @@ int init_int(void) {
|
|
|
/* disable all irqs */
|
|
|
|
|
|
/* IMR: interrupt mask register */
|
|
|
-// outb(0xff, PIC0_IMR);
|
|
|
-// outb(0xff, PIC1_IMR);
|
|
|
+ outb(0xff, PIC0_IMR);
|
|
|
+ outb(0xff, PIC1_IMR);
|
|
|
|
|
|
/* ICW: initial control word */
|
|
|
-// outb(0x11, PIC0_ICW1);
|
|
|
-// outb(0x20, PIC0_ICW2);
|
|
|
-// outb(0x04, PIC0_ICW3);
|
|
|
-// outb(0x01, PIC0_ICW4);
|
|
|
+ outb(0x11, PIC0_ICW1);
|
|
|
+ outb(0x20, PIC0_ICW2);
|
|
|
+ outb(0x04, PIC0_ICW3);
|
|
|
+ outb(0x01, PIC0_ICW4);
|
|
|
|
|
|
-// outb(0x11, PIC1_ICW1);
|
|
|
-// outb(0x28, PIC1_ICW2);
|
|
|
-// outb(0x02, PIC1_ICW3);
|
|
|
-// outb(0x01, PIC1_ICW4);
|
|
|
+ outb(0x11, PIC1_ICW1);
|
|
|
+ outb(0x28, PIC1_ICW2);
|
|
|
+ outb(0x02, PIC1_ICW3);
|
|
|
+ outb(0x01, PIC1_ICW4);
|
|
|
|
|
|
|
|
|
/* enable all interrupts */
|
|
|
|
|
|
-// outb(0x00, PIC0_IMR);
|
|
|
-// outb(0x00, PIC1_IMR);
|
|
|
+ outb(0x00, PIC0_IMR);
|
|
|
+ outb(0x00, PIC1_IMR);
|
|
|
|
|
|
+ set_int_gate(idt_table + 0x00, 0, divide_error);
|
|
|
set_int_gate(idt_table + 0x80, 0, syscall);
|
|
|
|
|
|
return 0;
|
|
|
@@ -89,3 +90,9 @@ void syscall(void) {
|
|
|
}
|
|
|
|
|
|
|
|
|
+void do_divide_error(__uint64_t *rsp) {
|
|
|
+ printf("int #0x00: divide error. \n");
|
|
|
+ printf("RSP: %q\n", rsp);
|
|
|
+
|
|
|
+ return;
|
|
|
+}
|