Author: sginsberg
Date: Sun Oct 25 16:56:38 2009
New Revision: 43741
URL:
http://svn.reactos.org/svn/reactos?rev=43741&view=rev
Log:
- DBGKD_WAIT_STATE_CHANGE64 is used in KD protocol 5, not number 6 that we use. Protocol 6
uses the DBGKD_ANY_WAIT_STATE_CHANGE structure which is sized according to the largest
control-report structure (AMD64_DBGKD_CONTROL_REPORT currently), and is larger than
DBGKD_WAIT_STATE_CHANGE64 on x86. This worked because our DBGKD_WAIT_STATE_CHANGE32/64
structures contained incorrect DBGKD_CONTROL_REPORT (used) and CONTEXT (unused) members
that sized up the wait-state structure to pass WinDbg's length verification! It
actually becomes larger than DBGKD_ANY_WAIT_STATE_CHANGE, but WinDbg only seems bail out
only if the structure is too small. Remove the incorrect members from the protocol 5
structures and change to DBGKD_ANY_WAIT_STATE_CHANGE everywhere.
- Correct the value of SIZE_OF_FX_REGISTERS -- it was 4 times too low which resulted in
KeContextToTrapFrame not properly clearing out the XMM register area. Correct the define
and move it out from ke.h to x86's ketypes.h and use it in the FXSAVE format
structure. Also remove the IOPM definitions from ke.h as they have been in the NDK for a
while.
- KD uses STRINGs, not ANSI_STRINGs -- they are the same thing, but let's be
consistent.
- ExceptionRecord32To64 should be available for both 32 and 64 bit builds (and it
shouldn't be a forceinline). Get rid of CopyExceptionRecord and determine if we need
to convert or can just copy it directly instead.
- Use _WIN64 instead of _M_AMD64 when determining if we need to set the
DBGKD_VERS_FLAG_PTR64 flag.
- Don't check Nt/DbgQueryDebugFilterState for zero or nonzero -- it actually returns
TRUE, FALSE or STATUS_INVALID_PARAMETER_1! Check for != TRUE in preparation for proper
implementation of NtSet/QueryDebugFilterState.
- Fix Format parameter of DbgPrintReturnControlC -- it is const like the other DbgPrint*
routines.
- Be consistent with the types used in debug.c and don't set local variables to zero
if we are going to return to caller -- this doesn't seem to be required anymore.
- Fix DebugService and DebugService2: DebugService should take a ULONG followed by 4
pointers and DebugService2 doesn't return anything.
- Use ZwCurrentProcess() instead of -1 or 0xFFFFFFFF (which is incorrect for 64-bit) for
the ProcessId parameter of DbgLoad/UnloadImageSymbols to clarify what is being passed.
Don't use ZwCurrentProcess() in KeBugCheckWithTf for the pointer parameter of
DbgUnLoadImageSymbols either. Use MAXULONG_PTR casted to PVOID instead.
- Use better named and sized variables in KdpTrap for setting the "return
register" in the caller's CONTEXT.
- Correct and clarify the comment documenting under what conditions we pass user mode
exceptions to the kernel debugger.
Modified:
trunk/reactos/include/ddk/winddk.h
trunk/reactos/include/ndk/i386/ketypes.h
trunk/reactos/include/ndk/rtlfuncs.h
trunk/reactos/include/reactos/windbgkd.h
trunk/reactos/lib/drivers/ip/network/routines.c
trunk/reactos/lib/rtl/debug.c
trunk/reactos/lib/rtl/powerpc/debug.c
trunk/reactos/lib/rtl/rtlp.h
trunk/reactos/ntoskrnl/ex/init.c
trunk/reactos/ntoskrnl/include/internal/kd64.h
trunk/reactos/ntoskrnl/include/internal/ke.h
trunk/reactos/ntoskrnl/kd/kdmain.c
trunk/reactos/ntoskrnl/kd64/amd64/kdsup.c
trunk/reactos/ntoskrnl/kd64/arm/kdsup.c
trunk/reactos/ntoskrnl/kd64/i386/kdsup.c
trunk/reactos/ntoskrnl/kd64/kdapi.c
trunk/reactos/ntoskrnl/kd64/kddata.c
trunk/reactos/ntoskrnl/kd64/kdinit.c
trunk/reactos/ntoskrnl/kd64/kdprint.c
trunk/reactos/ntoskrnl/kd64/kdtrap.c
trunk/reactos/ntoskrnl/ke/bug.c
trunk/reactos/ntoskrnl/ke/i386/exp.c
trunk/reactos/ntoskrnl/mm/sysldr.c
Modified: trunk/reactos/include/ddk/winddk.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/winddk.h?rev=4…
==============================================================================
--- trunk/reactos/include/ddk/winddk.h [iso-8859-1] (original)
+++ trunk/reactos/include/ddk/winddk.h [iso-8859-1] Sun Oct 25 16:56:38 2009
@@ -10359,23 +10359,23 @@
vDbgPrintEx(
IN ULONG ComponentId,
IN ULONG Level,
- IN LPCSTR Format,
+ IN PCCH Format,
IN va_list ap);
ULONG
NTAPI
vDbgPrintExWithPrefix(
- IN LPCSTR Prefix,
+ IN PCCH Prefix,
IN ULONG ComponentId,
IN ULONG Level,
- IN LPCSTR Format,
+ IN PCCH Format,
IN va_list ap);
NTKERNELAPI
ULONG
DDKCDECLAPI
DbgPrintReturnControlC(
- IN PCH Format,
+ IN PCCH Format,
IN ...);
ULONG
Modified: trunk/reactos/include/ndk/i386/ketypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/i386/ketypes.h…
==============================================================================
--- trunk/reactos/include/ndk/i386/ketypes.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/i386/ketypes.h [iso-8859-1] Sun Oct 25 16:56:38 2009
@@ -130,6 +130,11 @@
(MapNumber == IO_ACCESS_MAP_NONE) ? \
(USHORT)(sizeof(KTSS)) : \
(USHORT)(FIELD_OFFSET(KTSS, IoMaps[MapNumber-1].IoMap))
+
+//
+// Size of the XMM register save area in the FXSAVE format
+//
+#define SIZE_OF_FX_REGISTERS 128
//
// Static Kernel-Mode Address start (use MM_KSEG0_BASE for actual)
@@ -333,7 +338,7 @@
ULONG DataSelector;
ULONG MXCsr;
ULONG MXCsrMask;
- UCHAR RegisterArea[128];
+ UCHAR RegisterArea[SIZE_OF_FX_REGISTERS];
UCHAR Reserved3[128];
UCHAR Reserved4[224];
UCHAR Align16Byte[8];
Modified: trunk/reactos/include/ndk/rtlfuncs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/rtlfuncs.h?rev…
==============================================================================
--- trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] Sun Oct 25 16:56:38 2009
@@ -2669,7 +2669,7 @@
VOID
NTAPI
DbgLoadImageSymbols(
- IN PANSI_STRING Name,
+ IN PSTRING Name,
IN PVOID Base,
IN ULONG_PTR ProcessId
);
@@ -2677,7 +2677,7 @@
VOID
NTAPI
DbgUnLoadImageSymbols(
- IN PANSI_STRING Name,
+ IN PSTRING Name,
IN PVOID Base,
IN ULONG_PTR ProcessId
);
Modified: trunk/reactos/include/reactos/windbgkd.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/windbgkd.h…
==============================================================================
--- trunk/reactos/include/reactos/windbgkd.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/windbgkd.h [iso-8859-1] Sun Oct 25 16:56:38 2009
@@ -446,8 +446,6 @@
DBGKM_EXCEPTION32 Exception;
DBGKD_LOAD_SYMBOLS32 LoadSymbols;
} u;
- DBGKD_CONTROL_REPORT ControlReport;
- CONTEXT Context;
} DBGKD_WAIT_STATE_CHANGE32, *PDBGKD_WAIT_STATE_CHANGE32;
typedef struct _DBGKD_WAIT_STATE_CHANGE64
@@ -463,8 +461,6 @@
DBGKM_EXCEPTION64 Exception;
DBGKD_LOAD_SYMBOLS64 LoadSymbols;
} u;
- DBGKD_CONTROL_REPORT ControlReport;
- CONTEXT Context;
} DBGKD_WAIT_STATE_CHANGE64, *PDBGKD_WAIT_STATE_CHANGE64;
typedef struct _DBGKD_ANY_WAIT_STATE_CHANGE
@@ -864,15 +860,10 @@
} u;
} DBGKD_TRACE_IO, *PDBGKD_TRACE_IO;
-#if defined(_M_AMD64)
-
-#define CopyExceptionRecord(Ex64From, Ex64To) \
- RtlCopyMemory(Ex64To, Ex64From, sizeof(EXCEPTION_RECORD64))
-
-#else
-
-FORCEINLINE
+static
+__inline
VOID
+NTAPI
ExceptionRecord32To64(IN PEXCEPTION_RECORD32 Ex32,
OUT PEXCEPTION_RECORD64 Ex64)
{
@@ -890,9 +881,4 @@
}
}
-#define CopyExceptionRecord(Ex32From, Ex64To) \
- ExceptionRecord32To64((PEXCEPTION_RECORD32)Ex32From, Ex64To)
-
#endif
-
-#endif
Modified: trunk/reactos/lib/drivers/ip/network/routines.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/network/rou…
==============================================================================
--- trunk/reactos/lib/drivers/ip/network/routines.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/network/routines.c [iso-8859-1] Sun Oct 25 16:56:38 2009
@@ -94,8 +94,8 @@
UINT Length;
PCHAR Buffer;
- if (!(DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_PBUFFER | DPFLTR_MASK)) ||
- !(DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_TCP | DPFLTR_MASK))) {
+ if ((DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_PBUFFER | DPFLTR_MASK) != TRUE)
||
+ (DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_TCP | DPFLTR_MASK) != TRUE)) {
return;
}
@@ -139,8 +139,8 @@
PNDIS_BUFFER NextBuffer;
PCHAR CharBuffer;
- if (!(DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_PBUFFER | DPFLTR_MASK)) ||
- !(DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_IP | DPFLTR_MASK))) {
+ if ((DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_PBUFFER | DPFLTR_MASK) != TRUE)
||
+ (DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_IP | DPFLTR_MASK) != TRUE)) {
return;
}
Modified: trunk/reactos/lib/rtl/debug.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/debug.c?rev=43741&…
==============================================================================
--- trunk/reactos/lib/rtl/debug.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/debug.c [iso-8859-1] Sun Oct 25 16:56:38 2009
@@ -16,29 +16,29 @@
/* PRIVATE FUNCTIONS ********************************************************/
-NTSTATUS
-NTAPI
-DebugPrint(IN PANSI_STRING DebugString,
+ULONG
+NTAPI
+DebugPrint(IN PSTRING DebugString,
IN ULONG ComponentId,
IN ULONG Level)
{
/* Call the Debug Service */
return DebugService(BREAKPOINT_PRINT,
DebugString->Buffer,
- DebugString->Length,
+ UlongToPtr(DebugString->Length),
UlongToPtr(ComponentId),
UlongToPtr(Level));
}
-NTSTATUS
-NTAPI
-DebugPrompt(IN PCSTRING Output,
+ULONG
+NTAPI
+DebugPrompt(IN PSTRING Output,
IN PSTRING Input)
{
/* Call the Debug Service */
return DebugService(BREAKPOINT_PROMPT,
Output->Buffer,
- Output->Length,
+ UlongToPtr(Output->Length),
Input->Buffer,
UlongToPtr(Input->MaximumLength));
}
@@ -47,22 +47,22 @@
ULONG
NTAPI
-vDbgPrintExWithPrefixInternal(IN LPCSTR Prefix,
+vDbgPrintExWithPrefixInternal(IN PCCH Prefix,
IN ULONG ComponentId,
IN ULONG Level,
- IN LPCSTR Format,
+ IN PCCH Format,
IN va_list ap,
IN BOOLEAN HandleBreakpoint)
{
NTSTATUS Status;
- ANSI_STRING DebugString;
+ STRING DebugString;
CHAR Buffer[512];
ULONG Length, PrefixLength;
EXCEPTION_RECORD ExceptionRecord;
/* Check if we should print it or not */
if ((ComponentId != MAXULONG) &&
- !(NtQueryDebugFilterState(ComponentId, Level)))
+ (NtQueryDebugFilterState(ComponentId, Level)) != TRUE)
{
/* This message is masked */
return STATUS_SUCCESS;
@@ -90,7 +90,6 @@
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
/* Fail */
- Length = PrefixLength = 0;
_SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
@@ -160,10 +159,10 @@
*/
ULONG
NTAPI
-vDbgPrintExWithPrefix(IN LPCSTR Prefix,
+vDbgPrintExWithPrefix(IN PCCH Prefix,
IN ULONG ComponentId,
IN ULONG Level,
- IN LPCSTR Format,
+ IN PCCH Format,
IN va_list ap)
{
/* Call the internal routine that also handles ControlC */
@@ -182,7 +181,7 @@
NTAPI
vDbgPrintEx(IN ULONG ComponentId,
IN ULONG Level,
- IN LPCSTR Format,
+ IN PCCH Format,
IN va_list ap)
{
/* Call the internal routine that also handles ControlC */
@@ -202,19 +201,19 @@
DbgPrint(PCCH Format,
...)
{
- ULONG n;
+ ULONG Status;
va_list ap;
/* Call the internal routine that also handles ControlC */
va_start(ap, Format);
- n = vDbgPrintExWithPrefixInternal("",
- -1,
- DPFLTR_ERROR_LEVEL,
- Format,
- ap,
- TRUE);
+ Status = vDbgPrintExWithPrefixInternal("",
+ -1,
+ DPFLTR_ERROR_LEVEL,
+ Format,
+ ap,
+ TRUE);
va_end(ap);
- return n;
+ return Status;
}
/*
@@ -227,19 +226,19 @@
IN PCCH Format,
...)
{
- ULONG n;
+ ULONG Status;
va_list ap;
/* Call the internal routine that also handles ControlC */
va_start(ap, Format);
- n = vDbgPrintExWithPrefixInternal("",
- ComponentId,
- Level,
- Format,
- ap,
- TRUE);
+ Status = vDbgPrintExWithPrefixInternal("",
+ ComponentId,
+ Level,
+ Format,
+ ap,
+ TRUE);
va_end(ap);
- return n;
+ return Status;
}
/*
@@ -247,22 +246,22 @@
*/
ULONG
__cdecl
-DbgPrintReturnControlC(PCH Format,
+DbgPrintReturnControlC(PCCH Format,
...)
{
- ULONG n;
+ ULONG Status;
va_list ap;
/* Call the internal routine that also handles ControlC */
va_start(ap, Format);
- n = vDbgPrintExWithPrefixInternal("",
- -1,
- DPFLTR_ERROR_LEVEL,
- Format,
- ap,
- FALSE);
+ Status = vDbgPrintExWithPrefixInternal("",
+ -1,
+ DPFLTR_ERROR_LEVEL,
+ Format,
+ ap,
+ FALSE);
va_end(ap);
- return n;
+ return Status;
}
/*
@@ -274,7 +273,7 @@
OUT PCH Response,
IN ULONG MaximumResponseLength)
{
- CSTRING Output;
+ STRING Output;
STRING Input;
/* Setup the input string */
@@ -283,7 +282,7 @@
/* Setup the output string */
Output.Length = strlen(Prompt);
- Output.Buffer = Prompt;
+ Output.Buffer = (PCH)Prompt;
/* Call the system service */
return DebugPrompt(&Output, &Input);
@@ -319,7 +318,7 @@
*/
VOID
NTAPI
-DbgLoadImageSymbols(IN PANSI_STRING Name,
+DbgLoadImageSymbols(IN PSTRING Name,
IN PVOID Base,
IN ULONG_PTR ProcessId)
{
@@ -328,7 +327,7 @@
/* Setup the symbol data */
SymbolInfo.BaseOfDll = Base;
- SymbolInfo.ProcessId = (ULONG)ProcessId;
+ SymbolInfo.ProcessId = ProcessId;
/* Get NT Headers */
NtHeader = RtlImageNtHeader(Base);
@@ -353,7 +352,7 @@
*/
VOID
NTAPI
-DbgUnLoadImageSymbols(IN PANSI_STRING Name,
+DbgUnLoadImageSymbols(IN PSTRING Name,
IN PVOID Base,
IN ULONG_PTR ProcessId)
{
@@ -361,7 +360,7 @@
/* Setup the symbol data */
SymbolInfo.BaseOfDll = Base;
- SymbolInfo.ProcessId = (ULONG)ProcessId;
+ SymbolInfo.ProcessId = ProcessId;
SymbolInfo.CheckSum = SymbolInfo.SizeOfImage = 0;
/* Load the symbols */
Modified: trunk/reactos/lib/rtl/powerpc/debug.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/powerpc/debug.c?re…
==============================================================================
--- trunk/reactos/lib/rtl/powerpc/debug.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/powerpc/debug.c [iso-8859-1] Sun Oct 25 16:56:38 2009
@@ -9,12 +9,12 @@
VOID
DbgBreakPointWithStatus(ULONG Status) { __asm__("ti 31,0,0"); }
-NTSTATUS
+ULONG
NTAPI
DebugService
-(ULONG Service, const void *Buffer, ULONG Length, PVOID Arg1, PVOID Arg2)
+(ULONG Service, PVOID Argument1, PVOID Argument1, PVOID Argument3, PVOID Argument4)
{
- NTSTATUS Result;
+ ULONG Result;
__asm__("mr 0,%1\n\t"
"mr 3,%2\n\t"
"mr 4,%3\n\t"
@@ -26,17 +26,16 @@
"=r" (Result) :
"r" (0x10000),
"r" (Service),
- "r" (Buffer),
- "r" (Length),
- "r" (Arg1),
- "r" (Arg2) );
+ "r" (Argument1),
+ "r" (Argument2),
+ "r" (Argument3),
+ "r" (Argument4) );
return Result;
}
-NTSTATUS
+VOID
NTAPI
DebugService2
(PVOID Arg1, PVOID Arg2, ULONG Service)
{
- return STATUS_SUCCESS;
}
Modified: trunk/reactos/lib/rtl/rtlp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/rtlp.h?rev=43741&a…
==============================================================================
--- trunk/reactos/lib/rtl/rtlp.h [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/rtlp.h [iso-8859-1] Sun Oct 25 16:56:38 2009
@@ -145,20 +145,26 @@
NTAPI
RtlpCaptureContext(OUT PCONTEXT ContextRecord);
-/* i386/debug.S */
-NTSTATUS
+//
+// Debug Service calls
+//
+ULONG
NTAPI
-DebugService(IN ULONG Service,
- IN const void* Buffer,
- IN ULONG Length,
- IN PVOID Argument1,
- IN PVOID Argument2);
+DebugService(
+ IN ULONG Service,
+ IN PVOID Argument1,
+ IN PVOID Argument2,
+ IN PVOID Argument3,
+ IN PVOID Argument4
+);
-NTSTATUS
+VOID
NTAPI
-DebugService2(IN PVOID Argument1,
- IN PVOID Argument2,
- IN ULONG Service);
+DebugService2(
+ IN PVOID Argument1,
+ IN PVOID Argument2,
+ IN ULONG Service
+);
/* Tags for the String Allocators */
#define TAG_USTR 'RTSU'
Modified: trunk/reactos/ntoskrnl/ex/init.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/init.c?rev=437…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/init.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/init.c [iso-8859-1] Sun Oct 25 16:56:38 2009
@@ -734,7 +734,7 @@
PLDR_DATA_TABLE_ENTRY LdrEntry;
BOOLEAN OverFlow = FALSE;
CHAR NameBuffer[256];
- ANSI_STRING SymbolString;
+ STRING SymbolString;
/* Loop the driver list */
NextEntry = LoaderBlock->LoadOrderListHead.Flink;
@@ -799,13 +799,13 @@
/* Check if the buffer was ok */
if (!OverFlow)
{
- /* Initialize the ANSI_STRING for the debugger */
+ /* Initialize the STRING for the debugger */
RtlInitString(&SymbolString, NameBuffer);
/* Load the symbols */
DbgLoadImageSymbols(&SymbolString,
LdrEntry->DllBase,
- 0xFFFFFFFF);
+ (ULONG_PTR)ZwCurrentProcess());
}
}
Modified: trunk/reactos/ntoskrnl/include/internal/kd64.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/kd64.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/kd64.h [iso-8859-1] Sun Oct 25 16:56:38 2009
@@ -217,7 +217,7 @@
NTAPI
KdpSymbol(
IN PSTRING DllPath,
- IN PKD_SYMBOLS_INFO DllBase,
+ IN PKD_SYMBOLS_INFO SymbolInfo,
IN BOOLEAN Unload,
IN KPROCESSOR_MODE PreviousMode,
IN PCONTEXT ContextRecord,
@@ -322,7 +322,7 @@
VOID
NTAPI
KdpSetContextState(
- IN PDBGKD_WAIT_STATE_CHANGE64 WaitStateChange,
+ IN PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange,
IN PCONTEXT Context
);
Modified: trunk/reactos/ntoskrnl/include/internal/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ke.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/ke.h [iso-8859-1] Sun Oct 25 16:56:38 2009
@@ -180,16 +180,6 @@
/* One of the Reserved Wait Blocks, this one is for the Thread's Timer */
#define TIMER_WAIT_BLOCK 0x3L
-/* IOPM Definitions */
-#define IO_ACCESS_MAP_NONE 0
-#define IOPM_OFFSET FIELD_OFFSET(KTSS, IoMaps[0].IoMap)
-#define KiComputeIopmOffset(MapNumber) \
- (MapNumber == IO_ACCESS_MAP_NONE) ? \
- (USHORT)(sizeof(KTSS)) : \
- (USHORT)(FIELD_OFFSET(KTSS, IoMaps[MapNumber-1].IoMap))
-
-#define SIZE_OF_FX_REGISTERS 32
-
/* INTERNAL KERNEL FUNCTIONS ************************************************/
VOID
Modified: trunk/reactos/ntoskrnl/kd/kdmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd/kdmain.c?rev=4…
==============================================================================
--- trunk/reactos/ntoskrnl/kd/kdmain.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kd/kdmain.c [iso-8859-1] Sun Oct 25 16:56:38 2009
@@ -368,13 +368,13 @@
if (ComponentId == KdComponentTable[i].ComponentId)
{
/* Check if mask are matching */
- return (Level & KdComponentTable[i].Level) != 0;
+ return (Level & KdComponentTable[i].Level) ? TRUE : FALSE;
}
}
}
/* Entry not found in the table, use default mask */
- return (Level & Kd_DEFAULT_MASK) != 0;
+ return (Level & Kd_DEFAULT_MASK) ? TRUE : FALSE;
}
NTSTATUS
Modified: trunk/reactos/ntoskrnl/kd64/amd64/kdsup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd64/amd64/kdsup.…
==============================================================================
--- trunk/reactos/ntoskrnl/kd64/amd64/kdsup.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kd64/amd64/kdsup.c [iso-8859-1] Sun Oct 25 16:56:38 2009
@@ -28,7 +28,7 @@
VOID
NTAPI
-KdpSetContextState(IN PDBGKD_WAIT_STATE_CHANGE64 WaitStateChange,
+KdpSetContextState(IN PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange,
IN PCONTEXT Context)
{
UNIMPLEMENTED;
Modified: trunk/reactos/ntoskrnl/kd64/arm/kdsup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd64/arm/kdsup.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/kd64/arm/kdsup.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kd64/arm/kdsup.c [iso-8859-1] Sun Oct 25 16:56:38 2009
@@ -28,7 +28,7 @@
VOID
NTAPI
-KdpSetContextState(IN PDBGKD_WAIT_STATE_CHANGE64 WaitStateChange,
+KdpSetContextState(IN PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange,
IN PCONTEXT Context)
{
UNIMPLEMENTED;
Modified: trunk/reactos/ntoskrnl/kd64/i386/kdsup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd64/i386/kdsup.c…
==============================================================================
--- trunk/reactos/ntoskrnl/kd64/i386/kdsup.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kd64/i386/kdsup.c [iso-8859-1] Sun Oct 25 16:56:38 2009
@@ -69,7 +69,7 @@
VOID
NTAPI
-KdpSetContextState(IN PDBGKD_WAIT_STATE_CHANGE64 WaitStateChange,
+KdpSetContextState(IN PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange,
IN PCONTEXT Context)
{
PKPRCB Prcb = KeGetCurrentPrcb();
Modified: trunk/reactos/ntoskrnl/kd64/kdapi.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd64/kdapi.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/kd64/kdapi.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kd64/kdapi.c [iso-8859-1] Sun Oct 25 16:56:38 2009
@@ -267,7 +267,7 @@
NTAPI
KdpSetCommonState(IN ULONG NewState,
IN PCONTEXT Context,
- IN PDBGKD_WAIT_STATE_CHANGE64 WaitStateChange)
+ IN PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange)
{
USHORT InstructionCount;
BOOLEAN HadBreakpoints;
@@ -280,9 +280,9 @@
WaitStateChange->Thread = (ULONG64)(LONG_PTR)KeGetCurrentThread();
WaitStateChange->ProgramCounter = (ULONG64)(LONG_PTR)KeGetContextPc(Context);
- /* Zero out the Control Report */
- RtlZeroMemory(&WaitStateChange->ControlReport,
- sizeof(DBGKD_CONTROL_REPORT));
+ /* Zero out the entire Control Report */
+ RtlZeroMemory(&WaitStateChange->AnyControlReport,
+ sizeof(DBGKD_ANY_CONTROL_REPORT));
/* Now copy the instruction stream and set the count */
RtlCopyMemory(&WaitStateChange->ControlReport.InstructionStream[0],
@@ -1296,7 +1296,7 @@
{
PSTRING ExtraData;
STRING Data, Header;
- DBGKD_WAIT_STATE_CHANGE64 WaitStateChange;
+ DBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange;
KCONTINUE_STATUS Status;
/* Start wait loop */
@@ -1335,7 +1335,7 @@
}
/* Setup the header */
- Header.Length = sizeof(DBGKD_WAIT_STATE_CHANGE64);
+ Header.Length = sizeof(DBGKD_ANY_WAIT_STATE_CHANGE);
Header.Buffer = (PCHAR)&WaitStateChange;
/* Send the packet */
@@ -1356,7 +1356,7 @@
IN BOOLEAN SecondChanceException)
{
STRING Header, Data;
- DBGKD_WAIT_STATE_CHANGE64 WaitStateChange;
+ DBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange;
KCONTINUE_STATUS Status;
/* Start report loop */
@@ -1366,15 +1366,21 @@
KdpSetCommonState(DbgKdExceptionStateChange, Context, &WaitStateChange);
/* Copy the Exception Record and set First Chance flag */
- CopyExceptionRecord(ExceptionRecord,
- &WaitStateChange.u.Exception.ExceptionRecord);
+#if !defined(_WIN64)
+ ExceptionRecord32To64((PEXCEPTION_RECORD32)ExceptionRecord,
+ &WaitStateChange.u.Exception.ExceptionRecord);
+#else
+ RtlCopyMemory(&WaitStateChange.u.Exception.ExceptionRecord,
+ ExceptionRecord,
+ sizeof(EXCEPTION_RECORD));
+#endif
WaitStateChange.u.Exception.FirstChance = !SecondChanceException;
/* Now finish creating the structure */
KdpSetContextState(&WaitStateChange, Context);
/* Setup the actual header to send to KD */
- Header.Length = sizeof(DBGKD_WAIT_STATE_CHANGE64);
+ Header.Length = sizeof(DBGKD_ANY_WAIT_STATE_CHANGE);
Header.Buffer = (PCHAR)&WaitStateChange;
/* Setup the trace data */
@@ -1828,20 +1834,26 @@
return KdDebuggerNotPresent;
}
+/*
+ * @unimplemented
+ */
NTSTATUS
NTAPI
-NtQueryDebugFilterState(ULONG ComponentId,
- ULONG Level)
+NtQueryDebugFilterState(IN ULONG ComponentId,
+ IN ULONG Level)
{
/* HACK */
return STATUS_SUCCESS;
}
+/*
+ * @unimplemented
+ */
NTSTATUS
NTAPI
-NtSetDebugFilterState(ULONG ComponentId,
- ULONG Level,
- BOOLEAN State)
+NtSetDebugFilterState(IN ULONG ComponentId,
+ IN ULONG Level,
+ IN BOOLEAN State)
{
/* HACK */
return STATUS_SUCCESS;
Modified: trunk/reactos/ntoskrnl/kd64/kddata.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd64/kddata.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/kd64/kddata.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kd64/kddata.c [iso-8859-1] Sun Oct 25 16:56:38 2009
@@ -360,7 +360,7 @@
0,
DBGKD_64BIT_PROTOCOL_VERSION2,
CURRENT_KD_SECONDARY_VERSION,
-#if defined(_M_AMD64)
+#if defined(_WIN64)
DBGKD_VERS_FLAG_DATA | DBGKD_VERS_FLAG_PTR64,
#else
DBGKD_VERS_FLAG_DATA,
Modified: trunk/reactos/ntoskrnl/kd64/kdinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd64/kdinit.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/kd64/kdinit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kd64/kdinit.c [iso-8859-1] Sun Oct 25 16:56:38 2009
@@ -75,7 +75,7 @@
{
BOOLEAN EnableKd, DisableKdAfterInit = FALSE, BlockEnable;
LPSTR CommandLine, DebugLine, DebugOptionStart, DebugOptionEnd;
- ANSI_STRING ImageName;
+ STRING ImageName;
PLDR_DATA_TABLE_ENTRY LdrEntry;
PLIST_ENTRY NextEntry;
ULONG i, j, Length, DebugOptionLength;
@@ -350,8 +350,10 @@
NameBuffer[j] = ANSI_NULL;
/* Load symbols for image */
- RtlInitAnsiString(&ImageName, NameBuffer);
- DbgLoadImageSymbols(&ImageName, LdrEntry->DllBase, -1);
+ RtlInitString(&ImageName, NameBuffer);
+ DbgLoadImageSymbols(&ImageName,
+ LdrEntry->DllBase,
+ (ULONG_PTR)ZwCurrentProcess());
/* Go to the next entry */
NextEntry = NextEntry->Flink;
Modified: trunk/reactos/ntoskrnl/kd64/kdprint.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd64/kdprint.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/kd64/kdprint.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kd64/kdprint.c [iso-8859-1] Sun Oct 25 16:56:38 2009
@@ -138,7 +138,7 @@
VOID
NTAPI
KdpSymbol(IN PSTRING DllPath,
- IN PKD_SYMBOLS_INFO DllBase,
+ IN PKD_SYMBOLS_INFO SymbolInfo,
IN BOOLEAN Unload,
IN KPROCESSOR_MODE PreviousMode,
IN PCONTEXT ContextRecord,
@@ -163,7 +163,7 @@
/* Report the new state */
Status = KdpReportLoadSymbolsStateChange(DllPath,
- DllBase,
+ SymbolInfo,
Unload,
&Prcb->ProcessorState.
ContextFrame);
@@ -243,7 +243,7 @@
{
NTSTATUS ReturnStatus;
BOOLEAN Entered;
- ANSI_STRING AnsiString;
+ STRING OutputString;
/* Assume failure */
*Status = FALSE;
@@ -268,12 +268,12 @@
/* FIXME: Support user-mode */
}
- /* Setup the ANSI string */
- AnsiString.Buffer = String;
- AnsiString.Length = Length;
+ /* Setup the output string */
+ OutputString.Buffer = String;
+ OutputString.Length = Length;
/* Log the print */
- //KdLogDbgPrint(&AnsiString);
+ //KdLogDbgPrint(&OutputString);
/* Check for a debugger */
if (KdDebuggerNotPresent)
@@ -287,7 +287,7 @@
Entered = KdEnterDebugger(TrapFrame, ExceptionFrame);
/* Print the string */
- if (KdpPrintString(&AnsiString))
+ if (KdpPrintString(&OutputString))
{
/* User pressed CTRL-C, breakpoint on return */
ReturnStatus = STATUS_BREAKPOINT;
Modified: trunk/reactos/ntoskrnl/kd64/kdtrap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd64/kdtrap.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/kd64/kdtrap.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kd64/kdtrap.c [iso-8859-1] Sun Oct 25 16:56:38 2009
@@ -135,8 +135,10 @@
IN BOOLEAN SecondChanceException)
{
BOOLEAN Unload = FALSE;
- ULONG_PTR ProgramCounter, ReturnValue;
+ ULONG_PTR ProgramCounter;
BOOLEAN Status = FALSE;
+ NTSTATUS ReturnStatus;
+ USHORT ReturnLength;
/*
* Check if we got a STATUS_BREAKPOINT with a SubID for Print, Prompt or
@@ -156,38 +158,38 @@
case BREAKPOINT_PRINT:
/* Call the worker routine */
- ReturnValue = KdpPrint((ULONG)KdpGetFirstParameter(ContextRecord),
- (ULONG)KdpGetSecondParameter(ContextRecord),
- (LPSTR)ExceptionRecord->
- ExceptionInformation[1],
- (USHORT)ExceptionRecord->
- ExceptionInformation[2],
- PreviousMode,
- TrapFrame,
- ExceptionFrame,
- &Status);
-
- /* Update the return value for the caller */
- KeSetContextReturnRegister(ContextRecord, ReturnValue);
- break;
-
- /* DbgPrompt */
- case BREAKPOINT_PROMPT:
-
- /* Call the worker routine */
- ReturnValue = KdpPrompt((LPSTR)ExceptionRecord->
+ ReturnStatus = KdpPrint((ULONG)KdpGetFirstParameter(ContextRecord),
+ (ULONG)KdpGetSecondParameter(ContextRecord),
+ (LPSTR)ExceptionRecord->
ExceptionInformation[1],
(USHORT)ExceptionRecord->
ExceptionInformation[2],
- (LPSTR)KdpGetFirstParameter(ContextRecord),
- (USHORT)KdpGetSecondParameter(ContextRecord),
PreviousMode,
TrapFrame,
- ExceptionFrame);
+ ExceptionFrame,
+ &Status);
+
+ /* Update the return value for the caller */
+ KeSetContextReturnRegister(ContextRecord, ReturnStatus);
+ break;
+
+ /* DbgPrompt */
+ case BREAKPOINT_PROMPT:
+
+ /* Call the worker routine */
+ ReturnLength = KdpPrompt((LPSTR)ExceptionRecord->
+ ExceptionInformation[1],
+ (USHORT)ExceptionRecord->
+ ExceptionInformation[2],
+ (LPSTR)KdpGetFirstParameter(ContextRecord),
+ (USHORT)KdpGetSecondParameter(ContextRecord),
+ PreviousMode,
+ TrapFrame,
+ ExceptionFrame);
Status = TRUE;
/* Update the return value for the caller */
- KeSetContextReturnRegister(ContextRecord, ReturnValue);
+ KeSetContextReturnRegister(ContextRecord, ReturnLength);
break;
/* DbgUnLoadImageSymbols */
Modified: trunk/reactos/ntoskrnl/ke/bug.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/bug.c?rev=4374…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/bug.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/bug.c [iso-8859-1] Sun Oct 25 16:56:38 2009
@@ -1197,7 +1197,7 @@
if (Reboot)
{
/* Unload symbols */
- DbgUnLoadImageSymbols(NULL, NtCurrentProcess(), 0);
+ DbgUnLoadImageSymbols(NULL, (PVOID)MAXULONG_PTR, 0);
HalReturnToFirmware(HalRebootRoutine);
}
Modified: trunk/reactos/ntoskrnl/ke/i386/exp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/exp.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/exp.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/exp.c [iso-8859-1] Sun Oct 25 16:56:38 2009
@@ -930,9 +930,8 @@
{
/*
* Break into the kernel debugger unless a user mode debugger
- * is present or user mode exceptions are ignored, unless this is
- * a breakpoint or a debug service in which case we have to
- * handle it.
+ * is present or user mode exceptions are ignored, except if this
+ * is a debug service which we must always pass to KD
*/
if ((!(PsGetCurrentProcess()->DebugPort) &&
!(KdIgnoreUmExceptions)) ||
Modified: trunk/reactos/ntoskrnl/mm/sysldr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/sysldr.c?rev=4…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/sysldr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/sysldr.c [iso-8859-1] Sun Oct 25 16:56:38 2009
@@ -730,7 +730,7 @@
PLDR_DATA_TABLE_ENTRY LdrEntry = ImageHandle;
PVOID BaseAddress = LdrEntry->DllBase;
NTSTATUS Status;
- ANSI_STRING TempName;
+ STRING TempName;
BOOLEAN HadEntry = FALSE;
/* Acquire the loader lock */
@@ -761,7 +761,9 @@
if (NT_SUCCESS(Status))
{
/* Unload the symbols */
- DbgUnLoadImageSymbols(&TempName, BaseAddress, -1);
+ DbgUnLoadImageSymbols(&TempName,
+ BaseAddress,
+ (ULONG_PTR)ZwCurrentProcess());
RtlFreeAnsiString(&TempName);
}
}
@@ -1528,7 +1530,7 @@
BOOLEAN LockOwned = FALSE;
PLIST_ENTRY NextEntry;
IMAGE_INFO ImageInfo;
- ANSI_STRING AnsiTemp;
+ STRING AnsiTemp;
PAGED_CODE();
/* Detect session-load */
@@ -1941,7 +1943,9 @@
RtlInitString(&AnsiTemp, Buffer);
/* Notify the debugger */
- DbgLoadImageSymbols(&AnsiTemp, LdrEntry->DllBase, -1);
+ DbgLoadImageSymbols(&AnsiTemp,
+ LdrEntry->DllBase,
+ (ULONG_PTR)ZwCurrentProcess());
LdrEntry->Flags |= LDRP_DEBUG_SYMBOLS_LOADED;
}