- 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
This commit is contained in:
Alex Ionescu 2007-02-18 19:30:33 +00:00
parent ff6bd309f3
commit ee1892a1a9
4 changed files with 10 additions and 48 deletions

View file

@ -14,28 +14,6 @@
/* FUNCTIONS *****************************************************************/ /* 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 * @implemented
*/ */

View file

@ -16,13 +16,14 @@
/* PRIVATE FUNCTIONS ********************************************************/ /* PRIVATE FUNCTIONS ********************************************************/
#if 0
NTSTATUS NTSTATUS
NTAPI NTAPI
DebugPrint(IN PANSI_STRING DebugString, DebugPrint(IN PANSI_STRING DebugString,
IN ULONG ComponentId, IN ULONG ComponentId,
IN ULONG Level) IN ULONG Level)
{ {
return STATUS_SUCCESS;
/* Call the INT2D Service */ /* Call the INT2D Service */
return DebugService(BREAKPOINT_PRINT, return DebugService(BREAKPOINT_PRINT,
DebugString->Buffer, DebugString->Buffer,
@ -30,13 +31,6 @@ DebugPrint(IN PANSI_STRING DebugString,
UlongToPtr(ComponentId), UlongToPtr(ComponentId),
UlongToPtr(Level)); UlongToPtr(Level));
} }
#else
NTSTATUS
NTAPI
DebugPrint(IN PANSI_STRING DebugString,
IN ULONG ComponentId,
IN ULONG Level);
#endif
NTSTATUS NTSTATUS
NTAPI NTAPI
@ -282,7 +276,7 @@ DbgPrompt(IN PCCH Prompt,
Input.Buffer = Response; Input.Buffer = Response;
/* Setup the output string */ /* Setup the output string */
Output.Length = strlen (Prompt); Output.Length = strlen(Prompt);
Output.Buffer = Prompt; Output.Buffer = Prompt;
/* Call the system service */ /* Call the system service */

View file

@ -471,7 +471,7 @@ _KiDebugService:
/* Call debug service dispatcher */ /* Call debug service dispatcher */
mov eax, [ebp+KTRAP_FRAME_EAX] mov eax, [ebp+KTRAP_FRAME_EAX]
mov ecx, [ebp+KTRAP_FRAME_ECX] mov ecx, [ebp+KTRAP_FRAME_ECX]
mov edx, [ebp+KTRAP_FRAME_EAX] mov edx, [ebp+KTRAP_FRAME_EDX]
/* Jump to INT3 handler */ /* Jump to INT3 handler */
jmp PrepareInt3 jmp PrepareInt3
@ -591,7 +591,7 @@ _CommonDispatchException:
mov [esp+EXCEPTION_RECORD_NUMBER_PARAMETERS], ecx mov [esp+EXCEPTION_RECORD_NUMBER_PARAMETERS], ecx
/* Check parameter count */ /* Check parameter count */
cmp eax, 0 cmp ecx, 0
jz NoParams jz NoParams
/* Get information */ /* Get information */
@ -613,9 +613,11 @@ NoParams:
SetPreviousMode: SetPreviousMode:
/* Calculate the previous mode */ /* Get the caller's CS */
mov eax, [ebp+KTRAP_FRAME_CS] mov eax, [ebp+KTRAP_FRAME_CS]
MaskMode: MaskMode:
/* Check if it was user-mode or kernel-mode */
and eax, MODE_MASK and eax, MODE_MASK
/* Dispatch the exception */ /* Dispatch the exception */
@ -797,8 +799,8 @@ PrepInt3:
/* Setup EIP, NTSTATUS and parameter count, then dispatch */ /* Setup EIP, NTSTATUS and parameter count, then dispatch */
mov ebx, [ebp+KTRAP_FRAME_EIP] mov ebx, [ebp+KTRAP_FRAME_EIP]
dec ebx dec ebx
mov eax, STATUS_BREAKPOINT
mov ecx, 3 mov ecx, 3
mov eax, STATUS_BREAKPOINT
call _CommonDispatchException call _CommonDispatchException
V86Int3: V86Int3:

View file

@ -23,18 +23,6 @@ extern ULONG NtOSCSDVersion;
/* FUNCTIONS *****************************************************************/ /* 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 * @implemented
*/ */