From c44e8d2c896b00d25944b2d9ee49a297672fb90f Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Sat, 3 Mar 2007 19:49:36 +0000 Subject: [PATCH] - Fix another typo in CommonDispatchException (with yet another critical flaw as a result). Sometimes, exceptions would incorrectly be detected as coming from user-mode even though CS was kernel mode. When creating the KTRAP_FRAME, the kernel would then add the Ring 3 RPL_MASK (3) (because it believed we're in usermode) to the kernel-mode CS, creating the invalid CS of 0xB, which would lead into a GPF during the iretd. - Re-enable DebugPrint since this now works. svn path=/trunk/; revision=25976 --- reactos/lib/rtl/debug.c | 1 - reactos/ntoskrnl/kd/kdmain.c | 1 + reactos/ntoskrnl/ke/i386/trap.s | 3 ++- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/reactos/lib/rtl/debug.c b/reactos/lib/rtl/debug.c index f91ad108987..77f35e16904 100644 --- a/reactos/lib/rtl/debug.c +++ b/reactos/lib/rtl/debug.c @@ -23,7 +23,6 @@ DebugPrint(IN PANSI_STRING DebugString, IN ULONG Level) { /* Call the INT2D Service */ - return STATUS_SUCCESS; return DebugService(BREAKPOINT_PRINT, DebugString->Buffer, DebugString->Length, diff --git a/reactos/ntoskrnl/kd/kdmain.c b/reactos/ntoskrnl/kd/kdmain.c index 168bf01909e..4e0d788471c 100644 --- a/reactos/ntoskrnl/kd/kdmain.c +++ b/reactos/ntoskrnl/kd/kdmain.c @@ -127,6 +127,7 @@ KdpEnterDebuggerException(IN PKTRAP_FRAME TrapFrame, /* This we can handle: simply bump EIP */ Context->Eip++; + return TRUE; } /* Get out of here if the Debugger isn't connected */ diff --git a/reactos/ntoskrnl/ke/i386/trap.s b/reactos/ntoskrnl/ke/i386/trap.s index 0bab3fcf9a7..cba533b27eb 100644 --- a/reactos/ntoskrnl/ke/i386/trap.s +++ b/reactos/ntoskrnl/ke/i386/trap.s @@ -604,7 +604,7 @@ NoParams: /* Set the record in ECX and check if this was V86 */ mov ecx, esp - test dword ptr [esp+KTRAP_FRAME_EFLAGS], EFLAGS_V86_MASK + test dword ptr [ebp+KTRAP_FRAME_EFLAGS], EFLAGS_V86_MASK jz SetPreviousMode /* Set V86 mode */ @@ -791,6 +791,7 @@ EnableInterrupts3: sti PrepInt3: + /* Prepare the exception */ mov esi, ecx mov edi, edx