feat: OSPanic(message)
This commit is contained in:
+30
-10
@@ -20,10 +20,36 @@ static const ASCII* GetExceptionClassString(UInt32 class) {
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((noreturn)) static void Halt() {
|
||||
while (1) {
|
||||
CPUDisableInterrupts();
|
||||
CPUWaitForInterrupt();
|
||||
}
|
||||
}
|
||||
|
||||
static void PrintSeparator() {
|
||||
OSLog("--------------------------------\n");
|
||||
}
|
||||
|
||||
static void DrawPanicHeader() {
|
||||
OSLog("\n\n");
|
||||
PrintSeparator();
|
||||
OSLog("\tKernel Panic! :(\n");
|
||||
PrintSeparator();
|
||||
}
|
||||
|
||||
static void DrawPanicFooter() {
|
||||
PrintSeparator();
|
||||
OSLog("\tSystem halted.\n");
|
||||
PrintSeparator();
|
||||
}
|
||||
|
||||
__attribute__((noreturn)) void OSPanic(const ASCII* message) {
|
||||
DrawPanicHeader();
|
||||
OSLog("\tReason: %s\n", message);
|
||||
DrawPanicFooter();
|
||||
Halt();
|
||||
}
|
||||
|
||||
__attribute__((noreturn)) void OSPanicException(ExceptionsContext* frame) {
|
||||
UInt32 esr = frame->esr_el1;
|
||||
@@ -31,9 +57,8 @@ __attribute__((noreturn)) void OSPanicException(ExceptionsContext* frame) {
|
||||
UInt32 length = (esr >> 25) & 0x1; // Instruction length (Bit 25)
|
||||
UInt32 syndrome = esr & 0x1FFFFFF; // Syndrome (Bits 24:0)
|
||||
|
||||
PrintSeparator();
|
||||
OSLog("Kernel Panic! :(\n");
|
||||
PrintSeparator();
|
||||
DrawPanicHeader();
|
||||
|
||||
OSLog("CPU Exception: %s (%d)\n", GetExceptionClassString(class), class);
|
||||
OSLog("ESR_EL1 (Syndrome): 0x%x (%d)\n", esr, syndrome);
|
||||
OSLog("Instruction pointer: 0x%x (%s)\n", frame->elr_el1, length ? "32-bit" : "64-bit");
|
||||
@@ -84,12 +109,7 @@ __attribute__((noreturn)) void OSPanicException(ExceptionsContext* frame) {
|
||||
OSLog("x26 = 0x%X; x27 = 0x%X\n", frame->x26, frame->x27);
|
||||
OSLog("\t\tx28 = 0x%X\n", frame->x28);
|
||||
OSLog("FP = 0x%X; LR = 0x%X\n", frame->x29, frame->x30);
|
||||
PrintSeparator();
|
||||
|
||||
OSLog("System halted.\n");
|
||||
|
||||
while (1) {
|
||||
CPUDisableInterrupts();
|
||||
CPUWaitForInterrupt();
|
||||
}
|
||||
DrawPanicFooter();
|
||||
Halt();
|
||||
}
|
||||
Reference in New Issue
Block a user