add int code to KePanic
This commit is contained in:
1 parent
6bff37746d
commit
b17c9ac854
10 files changed
+112
-99
No files matched your search
@@ -38,7 +38,7 @@ __declspec(dllexport) void DbgPrint(const char* fmt, ...) {
|
||||
}
|
||||
|
||||
// KePanic
|
||||
__declspec(dllexport) _Noreturn void KePanic(const char* fmt, ...) {
|
||||
__declspec(dllexport) _Noreturn void KePanic(int code, const char* fmt, ...) {
|
||||
// Silence! Stop the world!
|
||||
_disable();
|
||||
|
||||
@@ -49,7 +49,9 @@ __declspec(dllexport) _Noreturn void KePanic(const char* fmt, ...) {
|
||||
for (const char* p = banner; *p; p++)
|
||||
PrintChar(*p, 0xFF2222, 0x000000);
|
||||
|
||||
// Now print the caller's message through the normal vprintf path.
|
||||
// Print the panic code first, then the caller's message through the normal vprintf path.
|
||||
printf("Panic code: %d\n", code);
|
||||
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
vprintf(fmt, va);
|
||||
@@ -436,7 +438,7 @@ __declspec(dllexport) _Noreturn void KeFaultDispatchFrame(const KFAULT_FRAME* fr
|
||||
PROCESS* proc = thread ? thread->Owner : (PROCESS*)0;
|
||||
|
||||
if (!frame || frame->Magic != 0x3146544C5541464BULL) {
|
||||
KePanic("PANIC: bad KFAULT_FRAME %016llx\n",
|
||||
KePanic(KE_PANIC_CODE_FAULT, "PANIC: bad KFAULT_FRAME %016llx\n",
|
||||
(unsigned long long)(uintptr_t)frame);
|
||||
}
|
||||
|
||||
@@ -445,18 +447,18 @@ __declspec(dllexport) _Noreturn void KeFaultDispatchFrame(const KFAULT_FRAME* fr
|
||||
const char* name = KiFaultVectorName(vector);
|
||||
|
||||
if (vector == 14) {
|
||||
KePanic("PANIC: %s | RIP: %016llx | Code: %04llx | CR2: %016llx\n",
|
||||
KePanic(KE_PANIC_CODE_FAULT, "PANIC: %s | RIP: %016llx | Code: %04llx | CR2: %016llx\n",
|
||||
name,
|
||||
(unsigned long long)frame->Rip,
|
||||
(unsigned long long)frame->ErrorCode,
|
||||
(unsigned long long)frame->Cr2);
|
||||
} else if (KiFaultHasErrorCode(vector)) {
|
||||
KePanic("PANIC: %s | RIP: %016llx | Code: %04llx\n",
|
||||
KePanic(KE_PANIC_CODE_FAULT, "PANIC: %s | RIP: %016llx | Code: %04llx\n",
|
||||
name,
|
||||
(unsigned long long)frame->Rip,
|
||||
(unsigned long long)frame->ErrorCode);
|
||||
} else {
|
||||
KePanic("PANIC: %s | RIP: %016llx\n",
|
||||
KePanic(KE_PANIC_CODE_FAULT, "PANIC: %s | RIP: %016llx\n",
|
||||
name,
|
||||
(unsigned long long)frame->Rip);
|
||||
}
|
||||
@@ -476,7 +478,7 @@ __declspec(dllexport) _Noreturn void KeFaultDispatchFrame(const KFAULT_FRAME* fr
|
||||
// KeFaultDispatch - single C entry point for all three IDT fault stubs.
|
||||
//
|
||||
// The asm stubs (ke_syscall.asm) collect the CPU exception frame values and
|
||||
// call here. We check the CS RPL to decide: kernel fault → KePanic (halt),
|
||||
// call here. We check the CS RPL to decide: kernel fault → panic and halt,
|
||||
// user fault → KeBugCheckProcess (kill process, resume scheduler).
|
||||
// ---------------------------------------------------------------------------
|
||||
__declspec(dllexport) _Noreturn void KeFaultDispatch(int vector, uintptr_t rip,
|
||||
|
||||
Reference in new issue
Block a user