Author: ion
Date: Sun Feb 18 22:30:33 2007
New Revision: 25836
URL: 
http://svn.reactos.org/svn/reactos?rev=25836&view=rev
Log:
- 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.
Modified:
    branches/alex-kd-branch/reactos/dll/ntdll/dbg/dbgui.c
    branches/alex-kd-branch/reactos/lib/rtl/debug.c
    branches/alex-kd-branch/reactos/ntoskrnl/ke/i386/trap.s
    branches/alex-kd-branch/reactos/ntoskrnl/rtl/misc.c
Modified: branches/alex-kd-branch/reactos/dll/ntdll/dbg/dbgui.c
URL:
http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/dll/ntdl…
==============================================================================
--- branches/alex-kd-branch/reactos/dll/ntdll/dbg/dbgui.c (original)
+++ branches/alex-kd-branch/reactos/dll/ntdll/dbg/dbgui.c Sun Feb 18 22:30:33 2007
@@ -13,28 +13,6 @@
 #include <debug.h>
 /* 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
Modified: branches/alex-kd-branch/reactos/lib/rtl/debug.c
URL:
http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/lib/rtl/…
==============================================================================
--- branches/alex-kd-branch/reactos/lib/rtl/debug.c (original)
+++ branches/alex-kd-branch/reactos/lib/rtl/debug.c Sun Feb 18 22:30:33 2007
@@ -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));
-}
-#else
-NTSTATUS
-NTAPI
-DebugPrint(IN PANSI_STRING DebugString,
-           IN ULONG ComponentId,
-           IN ULONG Level);
-#endif
+                        UlongToPtr(Level));
+}
 NTSTATUS
 NTAPI
@@ -282,7 +276,7 @@
     Input.Buffer = Response;
     /* Setup the output string */
-    Output.Length = strlen (Prompt);
+    Output.Length = strlen(Prompt);
     Output.Buffer = Prompt;
     /* Call the system service */
Modified: branches/alex-kd-branch/reactos/ntoskrnl/ke/i386/trap.s
URL:
http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/ntoskrnl…
==============================================================================
--- branches/alex-kd-branch/reactos/ntoskrnl/ke/i386/trap.s (original)
+++ branches/alex-kd-branch/reactos/ntoskrnl/ke/i386/trap.s Sun Feb 18 22:30:33 2007
@@ -471,7 +471,7 @@
     /* 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 @@
     mov [esp+EXCEPTION_RECORD_NUMBER_PARAMETERS], ecx
     /* Check parameter count */
-    cmp eax, 0
+    cmp ecx, 0
     jz NoParams
     /* Get information */
@@ -613,9 +613,11 @@
 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 @@
     /* Setup EIP, NTSTATUS and parameter count, then dispatch */
     mov ebx, [ebp+KTRAP_FRAME_EIP]
     dec ebx
+    mov ecx, 3
     mov eax, STATUS_BREAKPOINT
-    mov ecx, 3
     call _CommonDispatchException
 V86Int3:
Modified: branches/alex-kd-branch/reactos/ntoskrnl/rtl/misc.c
URL:
http://svn.reactos.org/svn/reactos/branches/alex-kd-branch/reactos/ntoskrnl…
==============================================================================
--- branches/alex-kd-branch/reactos/ntoskrnl/rtl/misc.c (original)
+++ branches/alex-kd-branch/reactos/ntoskrnl/rtl/misc.c Sun Feb 18 22:30:33 2007
@@ -22,18 +22,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