kernel: add panic() function that accepts a cpu_context

This commit is contained in:
2023-05-03 19:22:12 +01:00
parent 390fe86657
commit a52571eb19
3 changed files with 11 additions and 4 deletions

View File

@@ -3,6 +3,7 @@
#include <arch/acpi.h>
#include <socks/printk.h>
#include <socks/sched.h>
#include <socks/panic.h>
#include <socks/libc/string.h>
#include <socks/machine/irq.h>
#include <socks/machine/cpu.h>
@@ -96,7 +97,7 @@ static void gpf_handler(struct cpu_context *regs)
static void pf_handler(struct cpu_context *regs)
{
printk("page fault (%016llx %016llx %016llx)", pf_faultptr(), regs->rip, regs->err_no);
panic_irq(regs, "page fault (%016llx %016llx %016llx)", pf_faultptr(), regs->rip, regs->err_no);
ml_halt_cpu();
}
@@ -228,6 +229,8 @@ void isr_dispatch(struct cpu_context *regs)
int_hook h = isr_handlers[regs->int_no];
if (h) {
h(regs);
} else {
panic_irq(regs, "unhandled exception %u", regs->int_no);
}
}