From ee1892a1a9129ef9f3b87ab61aac4ea6f523f98e Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Sun, 18 Feb 2007 19:30:33 +0000 Subject: [PATCH] - Fix KiDebugService to load EDX from KTRAP_FRAME_EDX, not KTRAP_FRAME_EAX!. - Fix CommonDispatchException to check for the argument count in ECX, not EAX. Previously we were ignoring parameter counts and never filling out exception records! - Fix DebugPrint to be the same in user-mode and kernel-mode by using DebugService. This now works because the bugs above were fixed. svn path=/branches/alex-kd-branch/; revision=25836 --- reactos/dll/ntdll/dbg/dbgui.c | 22 ---------------------- reactos/lib/rtl/debug.c | 14 ++++---------- reactos/ntoskrnl/ke/i386/trap.s | 10 ++++++---- reactos/ntoskrnl/rtl/misc.c | 12 ------------ 4 files changed, 10 insertions(+), 48 deletions(-) diff --git a/reactos/dll/ntdll/dbg/dbgui.c b/reactos/dll/ntdll/dbg/dbgui.c index e3e3a1a96c2..376b09d35d6 100644 --- a/reactos/dll/ntdll/dbg/dbgui.c +++ b/reactos/dll/ntdll/dbg/dbgui.c @@ -14,28 +14,6 @@ /* FUNCTIONS *****************************************************************/ -NTSTATUS -NTAPI -DebugService(IN ULONG Service, - IN PVOID Buffer, - IN ULONG Length, - IN PVOID Argument1, - IN PVOID Argument2); - -NTSTATUS -NTAPI -DebugPrint(IN PANSI_STRING DebugString, - IN ULONG ComponentId, - IN ULONG Level) -{ - /* Call the INT2D Service */ - return DebugService(BREAKPOINT_PRINT, - DebugString->Buffer, - DebugString->Length, - UlongToPtr(ComponentId), - UlongToPtr(Level)); -} - /* * @implemented */ diff --git a/reactos/lib/rtl/debug.c b/reactos/lib/rtl/debug.c index a8554e4aa8a..0972f017b21 100644 --- a/reactos/lib/rtl/debug.c +++ b/reactos/lib/rtl/debug.c @@ -16,27 +16,21 @@ /* PRIVATE FUNCTIONS ********************************************************/ -#if 0 NTSTATUS NTAPI DebugPrint(IN PANSI_STRING DebugString, IN ULONG ComponentId, IN ULONG Level) { + return STATUS_SUCCESS; + /* Call the INT2D Service */ return DebugService(BREAKPOINT_PRINT, DebugString->Buffer, DebugString->Length, UlongToPtr(ComponentId), - UlongToPtr(Level)); + UlongToPtr(Level)); } -#else -NTSTATUS -NTAPI -DebugPrint(IN PANSI_STRING DebugString, - IN ULONG ComponentId, - IN ULONG Level); -#endif NTSTATUS NTAPI @@ -282,7 +276,7 @@ DbgPrompt(IN PCCH Prompt, Input.Buffer = Response; /* Setup the output string */ - Output.Length = strlen (Prompt); + Output.Length = strlen(Prompt); Output.Buffer = Prompt; /* Call the system service */ diff --git a/reactos/ntoskrnl/ke/i386/trap.s b/reactos/ntoskrnl/ke/i386/trap.s index 443de9b6779..0bab3fcf9a7 100644 --- a/reactos/ntoskrnl/ke/i386/trap.s +++ b/reactos/ntoskrnl/ke/i386/trap.s @@ -471,7 +471,7 @@ _KiDebugService: /* Call debug service dispatcher */ mov eax, [ebp+KTRAP_FRAME_EAX] mov ecx, [ebp+KTRAP_FRAME_ECX] - mov edx, [ebp+KTRAP_FRAME_EAX] + mov edx, [ebp+KTRAP_FRAME_EDX] /* Jump to INT3 handler */ jmp PrepareInt3 @@ -591,7 +591,7 @@ _CommonDispatchException: mov [esp+EXCEPTION_RECORD_NUMBER_PARAMETERS], ecx /* Check parameter count */ - cmp eax, 0 + cmp ecx, 0 jz NoParams /* Get information */ @@ -613,9 +613,11 @@ NoParams: SetPreviousMode: - /* Calculate the previous mode */ + /* Get the caller's CS */ mov eax, [ebp+KTRAP_FRAME_CS] + MaskMode: + /* Check if it was user-mode or kernel-mode */ and eax, MODE_MASK /* Dispatch the exception */ @@ -797,8 +799,8 @@ PrepInt3: /* Setup EIP, NTSTATUS and parameter count, then dispatch */ mov ebx, [ebp+KTRAP_FRAME_EIP] dec ebx - mov eax, STATUS_BREAKPOINT mov ecx, 3 + mov eax, STATUS_BREAKPOINT call _CommonDispatchException V86Int3: diff --git a/reactos/ntoskrnl/rtl/misc.c b/reactos/ntoskrnl/rtl/misc.c index 4874dde7cf9..14e5b091fe8 100644 --- a/reactos/ntoskrnl/rtl/misc.c +++ b/reactos/ntoskrnl/rtl/misc.c @@ -23,18 +23,6 @@ extern ULONG NtOSCSDVersion; /* FUNCTIONS *****************************************************************/ -NTSTATUS -NTAPI -DebugPrint(IN PANSI_STRING DebugString, - IN ULONG ComponentId, - IN ULONG Level) -{ - /* Temporary hack */ - //KdpPrintString(DebugString->Buffer, DebugString->Length); - //HalDisplayString((PCHAR)DebugString->Buffer); - return STATUS_SUCCESS; -} - /* * @implemented */