Handle local APIC exceptions

This commit is contained in:
josh committed 2022-12-07 23:24:01 -05:00
1 parent 9b52ae58e8
commit b1a8f8d348
2 files changed
+23 -10

No files matched your search

+18 -6
View File
@@ -8,9 +8,14 @@ import ldc.llvmasm;
import hulk.fb;
import hulk.console;
import hulk.klog;
import hulk.apic;
struct idt
{
public static enum ulong EXCEPTION_LAPIC_TIMER = 0x70u;
public static enum ulong EXCEPTION_LAPIC_LINT0 = 0x71u;
public static enum ulong EXCEPTION_LAPIC_LINT1 = 0x72u;
struct idtr_t
{
ushort limit;
@@ -94,12 +99,19 @@ struct idt
public extern(C) void isr(ulong vector, ulong arg)
{
console.clear();
fb.clear(0xFF8000u);
klog.writefln("ISR %u, 0x%x", vector, arg);
__asm("cli", "");
for (;;)
if ((idt.EXCEPTION_LAPIC_TIMER <= vector) && (vector <= idt.EXCEPTION_LAPIC_LINT1))
{
__asm("hlt", "");
apic.isr(vector);
}
else
{
console.clear();
fb.clear(0xFF8000u);
klog.writefln("ISR %u, 0x%x", vector, arg);
__asm("cli", "");
for (;;)
{
__asm("hlt", "");
}
}
}