BarryServer : Git

All the code for all my projects
// BarryServer : Git / Nucleus / commit / c530261a6ef76632384504044bc0b0519a33938e / kernel / idt.c

// Related

Nucleus

Barry Task queues and full scheduling c530261 (3 years, 3 months ago)
diff --git a/kernel/idt.c b/kernel/idt.c
index 8a7f809..a7dc998 100644
--- a/kernel/idt.c
+++ b/kernel/idt.c
@@ -38,6 +38,8 @@ install_idt_entry(uint8_t num, void *addr)
 static void
 exc_handler(int num, struct InterruptFrame *frame, uint32_t err)
 {
+	asm volatile("cli");
+
 	if (!exceptions[num]) {
 		panic("Failed to handle exception %d (%#.8x)",
 		      num, err);
@@ -48,21 +50,27 @@ exc_handler(int num, struct InterruptFrame *frame, uint32_t err)
 
 	/* Send APIC EOI */
 	LAPIC(0xB0) = 0;
+
+	asm volatile("sti");
 }
 
 /* First level generic interrupt handler */
 static void
 int_handler(int num, struct InterruptFrame *frame)
 {
+	asm volatile("cli");
+
 	if (interrupts[num - 32])
 		interrupts[num - 32](frame);
 
 	/* Send EOI */
-	if (num >= 8)
+	if (num >= 32 + 8)
 		outb(0xA0, 0x20);
 	outb(0x20, 0x20);
 	/* Send APIC EOI*/
 	LAPIC(0xB0) = 0;
+
+	asm volatile("sti");
 }
 
 /* Exceptions */