mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 08:24:32 -08:00
[panic] Allow assert/panic to take optional user cpu_state
In places where the "user" state is available, like interrupt handlers, panic() and kassert() can now take an optional pointer to that user cpu_state structure, and the panic handler will print that out as well.
This commit is contained in:
@@ -91,11 +91,11 @@ isr_handler(cpu_state *regs)
|
||||
asm volatile ("mov %%dr5, %%r13" ::: "r13");
|
||||
asm volatile ("mov %%dr6, %%r14" ::: "r14");
|
||||
asm volatile ("mov %%dr7, %%r15" ::: "r15");
|
||||
kassert(false, "Debug exception");
|
||||
kassert(false, "Debug exception", regs);
|
||||
break;
|
||||
|
||||
case isr::isrDoubleFault:
|
||||
kassert(false, "Double fault");
|
||||
kassert(false, "Double fault", regs);
|
||||
break;
|
||||
|
||||
case isr::isrGPFault:
|
||||
@@ -113,7 +113,7 @@ isr_handler(cpu_state *regs)
|
||||
snprintf(message, sizeof(message), "General Protection Fault, error:%lx%s",
|
||||
regs->errorcode, regs->errorcode & 1 ? " external" : "");
|
||||
}
|
||||
kassert(false, message);
|
||||
kassert(false, message, regs);
|
||||
break;
|
||||
|
||||
case isr::isrPageFault: {
|
||||
@@ -138,7 +138,7 @@ isr_handler(cpu_state *regs)
|
||||
(regs->errorcode & 0x04) ? " user" : "",
|
||||
(regs->errorcode & 0x08) ? " reserved" : "",
|
||||
(regs->errorcode & 0x10) ? " ip" : "");
|
||||
kassert(false, message);
|
||||
kassert(false, message, regs);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -156,7 +156,7 @@ isr_handler(cpu_state *regs)
|
||||
|
||||
default:
|
||||
snprintf(message, sizeof(message), "Unknown interrupt 0x%lx", regs->interrupt);
|
||||
kassert(false, message);
|
||||
kassert(false, message, regs);
|
||||
}
|
||||
|
||||
// Return the IST for this vector to what it was
|
||||
|
||||
Reference in New Issue
Block a user