Nucleus
Barry Kernel threads + threads share address space 6217f0d (3 years, 1 month ago)
diff --git a/kernel/idt.c b/kernel/idt.c
index 0f2bdfd..6e04543 100644
--- a/kernel/idt.c
+++ b/kernel/idt.c
@@ -31,10 +31,13 @@ install_idt_entry(uint8_t num, void *addr)
if (num < 32)
type = 0x8F; /* Trap gate for exceptions */
+ if (num == 0x80)
+ type |= 3 << 5; /* Allowed from ring 3 */
+
IDT[num].offsetLower = (uintptr_t) addr & 0xFFFF;
IDT[num].selector = 0x08;
IDT[num].zero = 0;
- IDT[num].typeAttr = type | 0x60; /* Allowed from ring 3 */
+ IDT[num].typeAttr = type;
IDT[num].offsetHigher = (uintptr_t) addr >> 16;
}
@@ -58,8 +61,13 @@ isr_handler(struct InterruptFrame frame)
/* Run registered handler */
int_handler_t handler = interrupts[frame.intnum];
- if (handler)
+ struct InterruptFrame *oldFrame;
+ if (handler) {
+ oldFrame = cpu->frame;
+ cpu->frame = &frame;
handler(&frame);
+ cpu->frame = oldFrame;
+ }
}
/* Register an exception handler */