Author: sginsberg
Date: Sun Oct 4 22:19:43 2009
New Revision: 43291
URL:
http://svn.reactos.org/svn/reactos?rev=43291&view=rev
Log:
- Add STATUS_ASSERTION_FAILURE status code required for NT_ASSERT.
- Check KdReceivePacket return for KdPacketReceived instead of 0 for correctness.
- Use KdpDprintf instead of setting CR2 for unhandled cases.
- Add more variables to KdDebuggerDataBlock.
Modified:
trunk/reactos/include/reactos/windbgkd.h
trunk/reactos/ntoskrnl/include/internal/mm.h
trunk/reactos/ntoskrnl/kd64/kdapi.c
trunk/reactos/ntoskrnl/kd64/kddata.c
trunk/reactos/ntoskrnl/kd64/kdlock.c
trunk/reactos/ntoskrnl/kd64/kdprint.c
trunk/reactos/ntoskrnl/kd64/kdtrap.c
trunk/reactos/ntoskrnl/mm/ARM3/miarm.h
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 4 22:19:43 2009
@@ -178,7 +178,7 @@
// Fill Memory Flags
//
#define DBGKD_FILL_MEMORY_VIRTUAL 0x01
-#define DBGKD_FILL_MEMORY_PHYSICAL 0x002
+#define DBGKD_FILL_MEMORY_PHYSICAL 0x02
//
// Physical Memory Caching Flags
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] Sun Oct 4 22:19:43 2009
@@ -14,13 +14,14 @@
extern ULONG MmTotalNonPagedPoolQuota;
extern PHYSICAL_ADDRESS MmSharedDataPagePhysicalAddress;
extern ULONG MmNumberOfPhysicalPages;
+extern ULONG MmLowestPhysicalPage;
+extern ULONG MmHighestPhysicalPage;
extern PVOID MmPagedPoolBase;
extern ULONG MmPagedPoolSize;
extern PMEMORY_ALLOCATION_DESCRIPTOR MiFreeDescriptor;
extern MEMORY_ALLOCATION_DESCRIPTOR MiFreeDescriptorOrg;
-extern ULONG MmHighestPhysicalPage;
struct _KTRAP_FRAME;
struct _EPROCESS;
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 4 22:19:43 2009
@@ -282,7 +282,8 @@
#if 0
if (!MmIsAddressValid((PVOID)(ULONG_PTR)State->u.ReadMemory.TargetBaseAddress))
{
- Ke386SetCr2(State->u.ReadMemory.TargetBaseAddress);
+ KdpDprintf("Tried to read invalid address %p\n",
+ (PVOID)(ULONG_PTR)State->u.ReadMemory.TargetBaseAddress);
while (TRUE);
}
#endif
@@ -484,6 +485,7 @@
else
{
/* SMP not yet handled */
+ KdpDprintf("SMP UNHANDLED\n");
ControlStart = NULL;
while (TRUE);
}
@@ -534,6 +536,7 @@
else
{
/* SMP not yet handled */
+ KdpDprintf("SMP UNHANDLED\n");
ControlStart = NULL;
while (TRUE);
}
@@ -620,7 +623,7 @@
case DbgKdWriteVirtualMemoryApi:
/* FIXME: TODO */
- Ke386SetCr2(DbgKdWriteVirtualMemoryApi);
+ KdpDprintf("DbgKdWriteVirtualMemoryApi called\n");
while (TRUE);
break;
@@ -668,14 +671,14 @@
case DbgKdReadIoSpaceApi:
/* FIXME: TODO */
- Ke386SetCr2(DbgKdReadIoSpaceApi);
+ KdpDprintf("DbgKdReadIoSpaceApi called\n");
while (TRUE);
break;
case DbgKdWriteIoSpaceApi:
/* FIXME: TODO */
- Ke386SetCr2(DbgKdWriteIoSpaceApi);
+ KdpDprintf("DbgKdWriteIoSpaceApi called\n");
while (TRUE);
break;
@@ -704,64 +707,65 @@
case DbgKdReadPhysicalMemoryApi:
/* FIXME: TODO */
- goto fail;
- Ke386SetCr2(DbgKdReadPhysicalMemoryApi);
+ KdpDprintf("DbgKdReadPhysicalMemoryApi called for address
%I64X\n",
+ ManipulateState.u.ReadMemory.TargetBaseAddress);
+ goto Hack;
while (TRUE);
break;
case DbgKdWritePhysicalMemoryApi:
/* FIXME: TODO */
- Ke386SetCr2(DbgKdWritePhysicalMemoryApi);
+ KdpDprintf("DbgKdWritePhysicalMemoryApi called\n");
while (TRUE);
break;
case DbgKdQuerySpecialCallsApi:
/* FIXME: TODO */
- Ke386SetCr2(DbgKdQuerySpecialCallsApi);
+ KdpDprintf("DbgKdQuerySpecialCallsApi called\n");
while (TRUE);
break;
case DbgKdSetSpecialCallApi:
/* FIXME: TODO */
- Ke386SetCr2(DbgKdSetSpecialCallApi);
+ KdpDprintf("DbgKdSetSpecialCallApi called\n");
while (TRUE);
break;
case DbgKdClearSpecialCallsApi:
/* FIXME: TODO */
- Ke386SetCr2(DbgKdClearSpecialCallsApi);
+ KdpDprintf("DbgKdClearSpecialCallsApi called\n");
while (TRUE);
break;
case DbgKdSetInternalBreakPointApi:
/* FIXME: TODO */
- Ke386SetCr2(DbgKdSetInternalBreakPointApi);
+ KdpDprintf("DbgKdSetInternalBreakPointApi called\n");
while (TRUE);
break;
case DbgKdGetInternalBreakPointApi:
/* FIXME: TODO */
- Ke386SetCr2(DbgKdGetInternalBreakPointApi);
+ KdpDprintf("DbgKdGetInternalBreakPointApi called\n");
while (TRUE);
break;
case DbgKdReadIoSpaceExtendedApi:
/* FIXME: TODO */
- Ke386SetCr2(DbgKdReadIoSpaceExtendedApi);
+ KdpDprintf("DbgKdReadIoSpaceExtendedApi called\n");
while (TRUE);
break;
case DbgKdWriteIoSpaceExtendedApi:
/* FIXME: TODO */
- Ke386SetCr2(DbgKdWriteIoSpaceExtendedApi);
+ KdpDprintf("DbgKdWriteIoSpaceExtendedApi called\n");
while (TRUE);
break;
@@ -774,14 +778,14 @@
case DbgKdWriteBreakPointExApi:
/* FIXME: TODO */
- Ke386SetCr2(DbgKdWriteBreakPointExApi);
+ KdpDprintf("DbgKdWriteBreakPointExApi called\n");
while (TRUE);
break;
case DbgKdRestoreBreakPointExApi:
/* FIXME: TODO */
- Ke386SetCr2(DbgKdRestoreBreakPointExApi);
+ KdpDprintf("DbgKdRestoreBreakPointExApi called\n");
while (TRUE);
break;
@@ -794,70 +798,70 @@
case DbgKdSwitchProcessor:
/* FIXME: TODO */
- Ke386SetCr2(DbgKdSwitchProcessor);
+ KdpDprintf("DbgKdSwitchProcessor called\n");
while (TRUE);
break;
case DbgKdPageInApi:
/* FIXME: TODO */
- Ke386SetCr2(DbgKdPageInApi);
+ KdpDprintf("DbgKdPageInApi called\n");
while (TRUE);
break;
case DbgKdReadMachineSpecificRegister:
/* FIXME: TODO */
- Ke386SetCr2(DbgKdReadMachineSpecificRegister);
+ KdpDprintf("DbgKdReadMachineSpecificRegister called\n");
while (TRUE);
break;
case DbgKdWriteMachineSpecificRegister:
/* FIXME: TODO */
- Ke386SetCr2(DbgKdWriteMachineSpecificRegister);
+ KdpDprintf("DbgKdWriteMachineSpecificRegister called\n");
while (TRUE);
break;
case OldVlm1:
/* FIXME: TODO */
- Ke386SetCr2(OldVlm1);
+ KdpDprintf("OldVlm1 called\n");
while (TRUE);
break;
case OldVlm2:
/* FIXME: TODO */
- Ke386SetCr2(OldVlm2);
+ KdpDprintf("OldVlm2 called\n");
while (TRUE);
break;
case DbgKdSearchMemoryApi:
/* FIXME: TODO */
- Ke386SetCr2(DbgKdSearchMemoryApi);
+ KdpDprintf("DbgKdSearchMemoryApi called\n");
while (TRUE);
break;
case DbgKdGetBusDataApi:
/* FIXME: TODO */
- Ke386SetCr2(DbgKdGetBusDataApi);
+ KdpDprintf("DbgKdGetBusDataApi called\n");
while (TRUE);
break;
case DbgKdSetBusDataApi:
/* FIXME: TODO */
- Ke386SetCr2(DbgKdSetBusDataApi);
+ KdpDprintf("DbgKdSetBusDataApi called\n");
while (TRUE);
break;
case DbgKdCheckLowMemoryApi:
/* FIXME: TODO */
- Ke386SetCr2(DbgKdCheckLowMemoryApi);
+ KdpDprintf("DbgKdCheckLowMemoryApi called\n");
while (TRUE);
break;
@@ -870,7 +874,7 @@
case DbgKdFillMemoryApi:
/* FIXME: TODO */
- Ke386SetCr2(DbgKdFillMemoryApi);
+ KdpDprintf("DbgKdFillMemoryApi called\n");
while (TRUE);
break;
@@ -883,7 +887,7 @@
case DbgKdSwitchPartition:
/* FIXME: TODO */
- Ke386SetCr2(DbgKdSwitchPartition);
+ KdpDprintf("DbgKdSwitchPartition called\n");
while (TRUE);
break;
@@ -891,8 +895,9 @@
default:
/* Setup an empty message, with failure */
- while (TRUE);
-fail:
+ KdpDprintf("Received unknown API Number %lx\n",
ManipulateState.ApiNumber);
+ while (TRUE);
+Hack:
Data.Length = 0;
ManipulateState.ReturnStatus = STATUS_UNSUCCESSFUL;
@@ -1247,6 +1252,7 @@
KdEnableDebugger(VOID)
{
/* Use the internal routine */
+ KdpDprintf("KdEnableDebugger called\n");
while (TRUE);
return KdEnableDebuggerWithLock(TRUE);
}
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 4 22:19:43 2009
@@ -9,6 +9,7 @@
/* INCLUDES ******************************************************************/
#include <ntoskrnl.h>
+#include "../mm/arm3/miarm.h"
#define NDEBUG
#include <debug.h>
@@ -51,7 +52,7 @@
#if defined(_M_IX86) || defined(_M_AMD64)
ULONG KdpBreakpointInstruction = 0xCC; // INT3
#else
-#error TODO
+#error Define the breakpoint instruction for this architecture
#endif
BOOLEAN KdpOweBreakpoint;
BOOLEAN BreakpointsSuspended;
@@ -367,23 +368,23 @@
{0}, // MmSystemCacheStart
{0}, // MmSystemCacheEnd
{0}, // MmSystemCacheWs
- {0}, // MmPfnDatabase
- {0}, // MmSystemPtesStart
- {0}, // MmSystemPtesEnd
+ {PtrToUlong(&MmPfnDatabase)},
+ {PtrToUlong(MmSystemPtesStart)},
+ {PtrToUlong(MmSystemPtesEnd)},
{0}, // MmSubsectionBase
{0}, // MmNumberOfPagingFiles
- {0}, // MmLowestPhysicalPage
- {0}, // MmHighestPhysicalPage
- {0}, //
MmNumberOfPhysicalPages
- {0}, //
MmMaximumNonPagedPoolInBytes
- {0}, // MmNonPagedSystemStart
- {0}, // MmNonPagedPoolStart
- {0}, // MmNonPagedPoolEnd
- {0}, // MmPagedPoolStart
- {0}, // MmPagedPoolEnd
- {0}, // MmPagedPoolInfo
+ {PtrToUlong(&MmLowestPhysicalPage)},
+ {PtrToUlong(&MmHighestPhysicalPage)},
+ {PtrToUlong(&MmNumberOfPhysicalPages)},
+ {PtrToUlong(&MmMaximumNonPagedPoolInBytes)},
+ {PtrToUlong(&MmNonPagedSystemStart)},
+ {PtrToUlong(&MmNonPagedPoolStart)},
+ {PtrToUlong(&MmNonPagedPoolEnd)},
+ {PtrToUlong(&MmPagedPoolStart)},
+ {PtrToUlong(&MmPagedPoolEnd)},
+ {PtrToUlong(&MmPagedPoolInfo)},
PAGE_SIZE,
- {0}, //
MmSizeOfPagedPoolInBytes
+ {PtrToUlong(&MmSizeOfPagedPoolInBytes)},
{0}, // MmTotalCommitLimit
{0}, // MmTotalCommittedPages
{0}, // MmSharedCommit
@@ -399,7 +400,7 @@
{0}, // MmAvailablePages
{0}, //
MmResidentAvailablePages
{0}, // PoolTrackTable
- {0}, //
NonPagedPoolDescriptor
+ {PtrToUlong(&NonPagedPoolDescriptor)},
{PtrToUlong(&MmHighestUserAddress)},
{PtrToUlong(&MmSystemRangeStart)},
{PtrToUlong(&MmUserProbeAddress)},
@@ -421,9 +422,9 @@
{0}, // MmPeakCommitment
{0}, //
MmtotalCommitLimitMaximum
{PtrToUlong(&CmNtCSDVersion)},
- {0}, // MmPhysicalMemoryBlock
- {0}, // MmSessionBase
- {0}, // MmSessionSize
+ {PtrToUlong(&MmPhysicalMemoryBlock)},
+ {PtrToUlong(&MmSessionBase)},
+ {PtrToUlong(&MmSessionSize)},
{0},
{0},
FIELD_OFFSET(KTHREAD, NextProcessor),
@@ -471,6 +472,6 @@
KGDT_TSS,
0,
0,
- {0}, //
IopNumTriagDumpDataBlocks
+ {0}, //
IopNumTriageDumpDataBlocks
{0}, //
IopTriageDumpDataBlocks
};
Modified: trunk/reactos/ntoskrnl/kd64/kdlock.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd64/kdlock.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/kd64/kdlock.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kd64/kdlock.c [iso-8859-1] Sun Oct 4 22:19:43 2009
@@ -49,11 +49,11 @@
else
{
/* Now get a packet */
- if (!KdReceivePacket(PACKET_TYPE_KD_POLL_BREAKIN,
+ if (KdReceivePacket(PACKET_TYPE_KD_POLL_BREAKIN,
NULL,
NULL,
NULL,
- NULL))
+ NULL) == KdPacketReceived)
{
/* Successful breakin */
DoBreak = TRUE;
@@ -96,11 +96,11 @@
if (KeTryToAcquireSpinLockAtDpcLevel(&KdpDebuggerLock))
{
/* Now get a packet */
- if (!KdReceivePacket(PACKET_TYPE_KD_POLL_BREAKIN,
+ if (KdReceivePacket(PACKET_TYPE_KD_POLL_BREAKIN,
NULL,
NULL,
NULL,
- NULL))
+ NULL) == KdPacketReceived)
{
/* Successful breakin */
DoBreak = TRUE;
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 4 22:19:43 2009
@@ -61,6 +61,7 @@
IN PKEXCEPTION_FRAME ExceptionFrame)
{
/* FIXME */
+ KdpDprintf("KdpCommandString called\n");
while (TRUE);
}
@@ -118,6 +119,7 @@
IN PKEXCEPTION_FRAME ExceptionFrame)
{
/* FIXME */
+ KdpDprintf("KdpPrompt called\n");
while (TRUE);
return FALSE;
}
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 4 22:19:43 2009
@@ -30,7 +30,7 @@
/* Check if this is INT1 or 3, or if we're forced to handle it */
if ((ExceptionCode == STATUS_BREAKPOINT) ||
(ExceptionCode == STATUS_SINGLE_STEP) ||
- //(ExceptionCode == STATUS_ASSERTION_FAILURE) ||
+ (ExceptionCode == STATUS_ASSERTION_FAILURE) ||
(NtGlobalFlag & FLG_STOP_ON_EXCEPTION))
{
/* Check if we can't really handle this */
Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/miarm.h?r…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] Sun Oct 4 22:19:43 2009
@@ -83,6 +83,8 @@
C_ASSERT(sizeof(POOL_HEADER) == 8);
C_ASSERT(sizeof(POOL_HEADER) == sizeof(LIST_ENTRY));
+extern POOL_DESCRIPTOR NonPagedPoolDescriptor;
+
//
// END FIXFIX
//
@@ -119,9 +121,15 @@
extern ULONG MmSizeOfNonPagedPoolInBytes;
extern ULONG MmMaximumNonPagedPoolInBytes;
+extern PVOID MmNonPagedSystemStart;
extern PVOID MmNonPagedPoolStart;
extern PVOID MmNonPagedPoolExpansionStart;
extern PVOID MmNonPagedPoolEnd;
+extern ULONG MmSizeOfPagedPoolInBytes;
+extern PVOID MmPagedPoolStart;
+extern PVOID MmPagedPoolEnd;
+extern PVOID MmSessionBase;
+extern ULONG MmSessionSize;
extern PMMPTE MmFirstReservedMappingPte, MmLastReservedMappingPte;
extern PMMPTE MiFirstReservedZeroingPte;
extern MI_PFN_CACHE_ATTRIBUTE MiPlatformCacheAttributes[2][MmMaximumCacheType];