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
@@ -57,7 +57,7 @@ KTRAP_FRAME* KeGetCurrentTrapFrame(void) {
|
||||
|
||||
void KiEnterTrapFrame(KTRAP_FRAME* frame) {
|
||||
if (!frame || frame->Magic != KTRAP_FRAME_MAGIC)
|
||||
KePanic("KiEnterTrapFrame: invalid trap frame 0x%llX\n", (uint64_t)frame);
|
||||
KePanic(KE_PANIC_CODE_TRAP, "KiEnterTrapFrame: invalid trap frame 0x%llX\n", (uint64_t)frame);
|
||||
|
||||
THREAD* t = KeGetCurrentThread();
|
||||
if (!t) return;
|
||||
@@ -69,7 +69,7 @@ void KiEnterTrapFrame(KTRAP_FRAME* frame) {
|
||||
|
||||
void KiExitTrapFrame(KTRAP_FRAME* frame) {
|
||||
if (!frame || frame->Magic != KTRAP_FRAME_MAGIC)
|
||||
KePanic("KiExitTrapFrame: invalid trap frame 0x%llX\n", (uint64_t)frame);
|
||||
KePanic(KE_PANIC_CODE_TRAP, "KiExitTrapFrame: invalid trap frame 0x%llX\n", (uint64_t)frame);
|
||||
|
||||
// Give alertable user-mode returns a chance to redirect through the
|
||||
// registered user APC dispatcher before committing IRET slots.
|
||||
@@ -86,7 +86,7 @@ void KiExitTrapFrame(KTRAP_FRAME* frame) {
|
||||
THREAD* t = KeGetCurrentThread();
|
||||
if (t) {
|
||||
if (t->TrapFrame != frame)
|
||||
KePanic("KiExitTrapFrame: trap-frame stack mismatch top=0x%llX frame=0x%llX\n",
|
||||
KePanic(KE_PANIC_CODE_TRAP, "KiExitTrapFrame: trap-frame stack mismatch top=0x%llX frame=0x%llX\n",
|
||||
(uint64_t)t->TrapFrame, (uint64_t)frame);
|
||||
t->TrapFrame = frame->PreviousFrame;
|
||||
}
|
||||
@@ -97,17 +97,17 @@ void KiValidateSyscallTrapFrame(uint64_t nr, uint64_t a0, uint64_t a1,
|
||||
uint64_t a5) {
|
||||
KTRAP_FRAME* f = KeGetCurrentTrapFrame();
|
||||
if (!f)
|
||||
KePanic("syscall trap validation: no current trap frame for nr=%llu\n", nr);
|
||||
KePanic(KE_PANIC_CODE_TRAP, "syscall trap validation: no current trap frame for nr=%llu\n", nr);
|
||||
if (f->Magic != KTRAP_FRAME_MAGIC)
|
||||
KePanic("syscall trap validation: bad magic 0x%llX\n", f->Magic);
|
||||
KePanic(KE_PANIC_CODE_TRAP, "syscall trap validation: bad magic 0x%llX\n", f->Magic);
|
||||
if (f->Kind != KTRAP_KIND_SYSCALL)
|
||||
KePanic("syscall trap validation: kind=%u, expected syscall\n", f->Kind);
|
||||
KePanic(KE_PANIC_CODE_TRAP, "syscall trap validation: kind=%u, expected syscall\n", f->Kind);
|
||||
if (!KeTrapFrameFromUser(f) || f->PreviousMode != KTRAP_MODE_USER)
|
||||
KePanic("syscall trap validation: syscall did not come from user cs=0x%llX mode=%u\n",
|
||||
KePanic(KE_PANIC_CODE_TRAP, "syscall trap validation: syscall did not come from user cs=0x%llX mode=%u\n",
|
||||
f->Cs, f->PreviousMode);
|
||||
if (f->Rax != nr || f->Rcx != a0 || f->Rdx != a1 || f->R8 != a2 ||
|
||||
f->R9 != a3 || f->R10 != a4 || f->R11 != a5) {
|
||||
KePanic("syscall trap validation: arg mismatch nr=%llu tf=%llu/%llX/%llX/%llX/%llX/%llX/%llX call=%llu/%llX/%llX/%llX/%llX/%llX/%llX\n",
|
||||
KePanic(KE_PANIC_CODE_TRAP, "syscall trap validation: arg mismatch nr=%llu tf=%llu/%llX/%llX/%llX/%llX/%llX/%llX call=%llu/%llX/%llX/%llX/%llX/%llX/%llX\n",
|
||||
nr,
|
||||
f->Rax, f->Rcx, f->Rdx, f->R8, f->R9, f->R10, f->R11,
|
||||
nr, a0, a1, a2, a3, a4, a5);
|
||||
|
||||
Reference in new issue
Block a user