summaryrefslogtreecommitdiff
path: root/kernel/cpu
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-05-05 09:54:48 -0400
committerFreya Murphy <freya@freyacat.org>2025-05-05 09:58:20 -0400
commit592c6992c7ea0c2e4cbea79fadb1c845f2fc050e (patch)
tree5d98b664749b67eb20d7fc279ff36bcf44843f21 /kernel/cpu
parentoff by one (diff)
downloadcomus-592c6992c7ea0c2e4cbea79fadb1c845f2fc050e.tar.gz
comus-592c6992c7ea0c2e4cbea79fadb1c845f2fc050e.tar.bz2
comus-592c6992c7ea0c2e4cbea79fadb1c845f2fc050e.zip
pc spkr
Diffstat (limited to 'kernel/cpu')
-rw-r--r--kernel/cpu/idt.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/kernel/cpu/idt.c b/kernel/cpu/idt.c
index 7cbbb65..50e15e0 100644
--- a/kernel/cpu/idt.c
+++ b/kernel/cpu/idt.c
@@ -1,3 +1,5 @@
+#include "comus/drivers/spkr.h"
+#include "lib/klib.h"
#include <lib.h>
#include <comus/memory.h>
#include <comus/asm.h>
@@ -64,10 +66,11 @@ void idt_init(void)
uint64_t isr = (uint64_t)isr_stub_table[vector];
// interrupts before 0x20 are for cpu exceptions
+ uint64_t gate_type = (isr < 0x20) ? GATE_64BIT_TRAP : GATE_64BIT_INT;
entry->kernel_cs = 0x08; // offset of 1 into GDT
entry->ist = 0;
- entry->flags = PRESENT | RING0 | GATE_64BIT_INT;
+ entry->flags = PRESENT | RING0 | gate_type;
entry->isr_low = isr & 0xffff;
entry->isr_mid = (isr >> 16) & 0xffff;
entry->isr_high = (isr >> 32) & 0xffffffff;
@@ -148,9 +151,7 @@ __attribute__((noreturn)) void idt_exception_handler(uint64_t exception,
log_backtrace_ex((void *)state->rip, (void *)state->rbp);
- while (1) {
- halt();
- }
+ fatal_loop();
}
void isr_save(struct cpu_regs *regs)