- Create GCC_ULONG64 type to hack around a bug in GCC which is incapable of creating entries for externals at compile-time for 64-bit pointers.

- Rename NameSpaceRoot to ObpRootDirectoryObject, IopLogListHead to IopErrorLogListHead, BugcheckCallbackListHead to KeBugcheckCallbackListHead, BugcheckReasonCallbackListHead to KeBugcheckReasonCallbackListHead, ObTypeObjectType to ObpTypeObjectType.
- Fill out KdDebuggerDataBlock with the variables that ROS currently supports. Most Mm variables we don't have yet -- it's unknown how much this will hurt WinDBG compatibility/functionality.
- Add KdPrint circular buffer and buffer location/data variables.

svn path=/branches/alex-kd-branch/; revision=25845
This commit is contained in:
Alex Ionescu 2007-02-19 18:52:23 +00:00
parent f1f1afaa74
commit b9cd3f2d9d
17 changed files with 299 additions and 128 deletions

View file

@ -503,6 +503,7 @@ Author:
#define CBSTACK_STACK 0x0 #define CBSTACK_STACK 0x0
#define CBSTACK_TRAP_FRAME 0x4 #define CBSTACK_TRAP_FRAME 0x4
#define CBSTACK_CALLBACK_STACK 0x8 #define CBSTACK_CALLBACK_STACK 0x8
#define CBSTACK_EBP 0x18
#define CBSTACK_RESULT 0x20 #define CBSTACK_RESULT 0x20
#define CBSTACK_RESULT_LENGTH 0x24 #define CBSTACK_RESULT_LENGTH 0x24

View file

@ -47,92 +47,98 @@ typedef struct _DBGKD_DEBUG_DATA_HEADER64
ULONG Size; ULONG Size;
} DBGKD_DEBUG_DATA_HEADER64, *PDBGKD_DEBUG_DATA_HEADER64; } DBGKD_DEBUG_DATA_HEADER64, *PDBGKD_DEBUG_DATA_HEADER64;
typedef union _GCC_ULONG64
{
ULONG_PTR Pointer;
ULONG64 RealPointer;
} GCC_ULONG64, *PGCC_ULONG64;
typedef struct _KDDEBUGGER_DATA64 typedef struct _KDDEBUGGER_DATA64
{ {
DBGKD_DEBUG_DATA_HEADER64 Header; DBGKD_DEBUG_DATA_HEADER64 Header;
ULONG64 KernBase; ULONG64 KernBase;
ULONG64 BreakpointWithStatus; GCC_ULONG64 BreakpointWithStatus;
ULONG64 SavedContext; ULONG64 SavedContext;
USHORT ThCallbackStack; USHORT ThCallbackStack;
USHORT NextCallback; USHORT NextCallback;
USHORT FramePointer; USHORT FramePointer;
USHORT PaeEnabled:1; USHORT PaeEnabled:1;
ULONG64 KiCallUserMode; GCC_ULONG64 KiCallUserMode;
ULONG64 KeUserCallbackDispatcher; GCC_ULONG64 KeUserCallbackDispatcher;
ULONG64 PsLoadedModuleList; GCC_ULONG64 PsLoadedModuleList;
ULONG64 PsActiveProcessHead; GCC_ULONG64 PsActiveProcessHead;
ULONG64 PspCidTable; GCC_ULONG64 PspCidTable;
ULONG64 ExpSystemResourcesList; GCC_ULONG64 ExpSystemResourcesList;
ULONG64 ExpPagedPoolDescriptor; GCC_ULONG64 ExpPagedPoolDescriptor;
ULONG64 ExpNumberOfPagedPools; GCC_ULONG64 ExpNumberOfPagedPools;
ULONG64 KeTimeIncrement; GCC_ULONG64 KeTimeIncrement;
ULONG64 KeBugCheckCallbackListHead; GCC_ULONG64 KeBugCheckCallbackListHead;
ULONG64 KiBugcheckData; GCC_ULONG64 KiBugcheckData;
ULONG64 IopErrorLogListHead; GCC_ULONG64 IopErrorLogListHead;
ULONG64 ObpRootDirectoryObject; GCC_ULONG64 ObpRootDirectoryObject;
ULONG64 ObpTypeObjectType; GCC_ULONG64 ObpTypeObjectType;
ULONG64 MmSystemCacheStart; GCC_ULONG64 MmSystemCacheStart;
ULONG64 MmSystemCacheEnd; GCC_ULONG64 MmSystemCacheEnd;
ULONG64 MmSystemCacheWs; GCC_ULONG64 MmSystemCacheWs;
ULONG64 MmPfnDatabase; GCC_ULONG64 MmPfnDatabase;
ULONG64 MmSystemPtesStart; GCC_ULONG64 MmSystemPtesStart;
ULONG64 MmSystemPtesEnd; GCC_ULONG64 MmSystemPtesEnd;
ULONG64 MmSubsectionBase; GCC_ULONG64 MmSubsectionBase;
ULONG64 MmNumberOfPagingFiles; GCC_ULONG64 MmNumberOfPagingFiles;
ULONG64 MmLowestPhysicalPage; GCC_ULONG64 MmLowestPhysicalPage;
ULONG64 MmHighestPhysicalPage; GCC_ULONG64 MmHighestPhysicalPage;
ULONG64 MmNumberOfPhysicalPages; GCC_ULONG64 MmNumberOfPhysicalPages;
ULONG64 MmMaximumNonPagedPoolInBytes; GCC_ULONG64 MmMaximumNonPagedPoolInBytes;
ULONG64 MmNonPagedSystemStart; GCC_ULONG64 MmNonPagedSystemStart;
ULONG64 MmNonPagedPoolStart; GCC_ULONG64 MmNonPagedPoolStart;
ULONG64 MmNonPagedPoolEnd; GCC_ULONG64 MmNonPagedPoolEnd;
ULONG64 MmPagedPoolStart; GCC_ULONG64 MmPagedPoolStart;
ULONG64 MmPagedPoolEnd; GCC_ULONG64 MmPagedPoolEnd;
ULONG64 MmPagedPoolInformation; GCC_ULONG64 MmPagedPoolInformation;
ULONG64 MmPageSize; ULONG64 MmPageSize;
ULONG64 MmSizeOfPagedPoolInBytes; GCC_ULONG64 MmSizeOfPagedPoolInBytes;
ULONG64 MmTotalCommitLimit; GCC_ULONG64 MmTotalCommitLimit;
ULONG64 MmTotalCommittedPages; GCC_ULONG64 MmTotalCommittedPages;
ULONG64 MmSharedCommit; GCC_ULONG64 MmSharedCommit;
ULONG64 MmDriverCommit; GCC_ULONG64 MmDriverCommit;
ULONG64 MmProcessCommit; GCC_ULONG64 MmProcessCommit;
ULONG64 MmPagedPoolCommit; GCC_ULONG64 MmPagedPoolCommit;
ULONG64 MmExtendedCommit; GCC_ULONG64 MmExtendedCommit;
ULONG64 MmZeroedPageListHead; GCC_ULONG64 MmZeroedPageListHead;
ULONG64 MmFreePageListHead; GCC_ULONG64 MmFreePageListHead;
ULONG64 MmStandbyPageListHead; GCC_ULONG64 MmStandbyPageListHead;
ULONG64 MmModifiedPageListHead; GCC_ULONG64 MmModifiedPageListHead;
ULONG64 MmModifiedNoWritePageListHead; GCC_ULONG64 MmModifiedNoWritePageListHead;
ULONG64 MmAvailablePages; GCC_ULONG64 MmAvailablePages;
ULONG64 MmResidentAvailablePages; GCC_ULONG64 MmResidentAvailablePages;
ULONG64 PoolTrackTable; GCC_ULONG64 PoolTrackTable;
ULONG64 NonPagedPoolDescriptor; GCC_ULONG64 NonPagedPoolDescriptor;
ULONG64 MmHighestUserAddress; GCC_ULONG64 MmHighestUserAddress;
ULONG64 MmSystemRangeStart; GCC_ULONG64 MmSystemRangeStart;
ULONG64 MmUserProbeAddress; GCC_ULONG64 MmUserProbeAddress;
ULONG64 KdPrintCircularBuffer; GCC_ULONG64 KdPrintCircularBuffer;
ULONG64 KdPrintCircularBufferEnd; GCC_ULONG64 KdPrintCircularBufferEnd;
ULONG64 KdPrintWritePointer; GCC_ULONG64 KdPrintWritePointer;
ULONG64 KdPrintRolloverCount; GCC_ULONG64 KdPrintRolloverCount;
ULONG64 MmLoadedUserImageList; GCC_ULONG64 MmLoadedUserImageList;
ULONG64 NtBuildLab; GCC_ULONG64 NtBuildLab;
ULONG64 KiNormalSystemCall; GCC_ULONG64 KiNormalSystemCall;
ULONG64 KiProcessorBlock; GCC_ULONG64 KiProcessorBlock;
ULONG64 MmUnloadedDrivers; GCC_ULONG64 MmUnloadedDrivers;
ULONG64 MmLastUnloadedDriver; GCC_ULONG64 MmLastUnloadedDriver;
ULONG64 MmTriageActionTaken; GCC_ULONG64 MmTriageActionTaken;
ULONG64 MmSpecialPoolTag; GCC_ULONG64 MmSpecialPoolTag;
ULONG64 KernelVerifier; GCC_ULONG64 KernelVerifier;
ULONG64 MmVerifierData; GCC_ULONG64 MmVerifierData;
ULONG64 MmAllocatedNonPagedPool; GCC_ULONG64 MmAllocatedNonPagedPool;
ULONG64 MmPeakCommitment; GCC_ULONG64 MmPeakCommitment;
ULONG64 MmTotalCommitLimitMaximum; GCC_ULONG64 MmTotalCommitLimitMaximum;
ULONG64 CmNtCSDVersion; GCC_ULONG64 CmNtCSDVersion;
ULONG64 MmPhysicalMemoryBlock; GCC_ULONG64 MmPhysicalMemoryBlock;
ULONG64 MmSessionBase; GCC_ULONG64 MmSessionBase;
ULONG64 MmSessionSize; GCC_ULONG64 MmSessionSize;
ULONG64 MmSystemParentTablePage; GCC_ULONG64 MmSystemParentTablePage;
ULONG64 MmVirtualTranslationBase; GCC_ULONG64 MmVirtualTranslationBase;
USHORT OffsetKThreadNextProcessor; USHORT OffsetKThreadNextProcessor;
USHORT OffsetKThreadTeb; USHORT OffsetKThreadTeb;
USHORT OffsetKThreadKernelStack; USHORT OffsetKThreadKernelStack;
@ -154,9 +160,9 @@ typedef struct _KDDEBUGGER_DATA64
USHORT OffsetPrcbProcStateContext; USHORT OffsetPrcbProcStateContext;
USHORT OffsetPrcbNumber; USHORT OffsetPrcbNumber;
USHORT SizeEThread; USHORT SizeEThread;
ULONG64 KdPrintCircularBufferPtr; GCC_ULONG64 KdPrintCircularBufferPtr;
ULONG64 KdPrintBufferSize; GCC_ULONG64 KdPrintBufferSize;
ULONG64 KeLoaderBlock; GCC_ULONG64 KeLoaderBlock;
USHORT SizePcr; USHORT SizePcr;
USHORT OffsetPcrSelfPcr; USHORT OffsetPcrSelfPcr;
USHORT OffsetPcrCurrentPrcb; USHORT OffsetPcrCurrentPrcb;
@ -177,9 +183,9 @@ typedef struct _KDDEBUGGER_DATA64
USHORT GdtTss; USHORT GdtTss;
USHORT Gdt64R3CmCode; USHORT Gdt64R3CmCode;
USHORT Gdt64R3CmTeb; USHORT Gdt64R3CmTeb;
ULONG64 IopNumTriageDumpDataBlocks; GCC_ULONG64 IopNumTriageDumpDataBlocks;
ULONG64 IopTriageDumpDataBlocks; GCC_ULONG64 IopTriageDumpDataBlocks;
ULONG64 VfCrashDataBlock; GCC_ULONG64 VfCrashDataBlock;
} KDDEBUGGER_DATA64, *PKDDEBUGGER_DATA64; } KDDEBUGGER_DATA64, *PKDDEBUGGER_DATA64;
#endif #endif

View file

@ -16,6 +16,7 @@
.globl _DebugService@20 .globl _DebugService@20
.globl _DebugService2@12 .globl _DebugService2@12
.globl _DbgBreakPointNoBugCheck@0 .globl _DbgBreakPointNoBugCheck@0
.globl _RtlpBreakWithStatusInstruction@0
/* FUNCTIONS ***************************************************************/ /* FUNCTIONS ***************************************************************/
@ -35,6 +36,8 @@ _DbgUserBreakPoint@0:
.func DbgBreakPointWithStatus@4 .func DbgBreakPointWithStatus@4
_DbgBreakPointWithStatus@4: _DbgBreakPointWithStatus@4:
mov eax, [esp+4] mov eax, [esp+4]
_RtlpBreakWithStatusInstruction@0:
int 3 int 3
ret 4 ret 4
.endfunc .endfunc

View file

@ -172,11 +172,11 @@ CmFindObject(POBJECT_CREATE_INFORMATION ObjectCreateInfo,
if (ObjectCreateInfo->RootDirectory == NULL) if (ObjectCreateInfo->RootDirectory == NULL)
{ {
ObReferenceObjectByPointer(NameSpaceRoot, ObReferenceObjectByPointer(ObpRootDirectoryObject,
DIRECTORY_TRAVERSE, DIRECTORY_TRAVERSE,
CmiKeyType, CmiKeyType,
ObjectCreateInfo->ProbeMode); ObjectCreateInfo->ProbeMode);
CurrentObject = NameSpaceRoot; CurrentObject = ObpRootDirectoryObject;
} }
else else
{ {
@ -312,7 +312,7 @@ Next:
if (Status == STATUS_REPARSE) if (Status == STATUS_REPARSE)
{ {
/* reparse the object path */ /* reparse the object path */
NextObject = NameSpaceRoot; NextObject = ObpRootDirectoryObject;
current = PathString.Buffer; current = PathString.Buffer;
ObReferenceObjectByPointer(NextObject, ObReferenceObjectByPointer(NextObject,

View file

@ -24,9 +24,19 @@ ULONG NtMajorVersion = 5;
ULONG NtMinorVersion = 0; ULONG NtMinorVersion = 0;
ULONG NtOSCSDVersion = BUILD_OSCSDVERSION(4, 0); ULONG NtOSCSDVersion = BUILD_OSCSDVERSION(4, 0);
ULONG NtBuildNumber = KERNEL_VERSION_BUILD; ULONG NtBuildNumber = KERNEL_VERSION_BUILD;
/* NT System Info */
ULONG NtGlobalFlag; ULONG NtGlobalFlag;
ULONG ExSuiteMask; ULONG ExSuiteMask;
/* Cm Version Info */
ULONG CmNtSpBuildNumber;
ULONG CmNtCSDVersion;
ULONG CmNtCSDReleaseType;
UNICODE_STRING CmVersionString;
UNICODE_STRING CmCSDVersionString;
CHAR NtBuildLab[] = KERNEL_VERSION_BUILD_STR;
/* Init flags and settings */ /* Init flags and settings */
ULONG ExpInitializationPhase; ULONG ExpInitializationPhase;
BOOLEAN ExpInTextModeSetup; BOOLEAN ExpInTextModeSetup;

View file

@ -18,9 +18,12 @@ extern ERESOURCE ExpFirmwareTableResource;
extern LIST_ENTRY ExpFirmwareTableProviderListHead; extern LIST_ENTRY ExpFirmwareTableProviderListHead;
extern BOOLEAN ExpIsWinPEMode; extern BOOLEAN ExpIsWinPEMode;
extern ULONG NtGlobalFlag; extern ULONG NtGlobalFlag;
extern LIST_ENTRY ExpSystemResourcesList;
ULONG ExpAnsiCodePageDataOffset, ExpOemCodePageDataOffset; ULONG ExpAnsiCodePageDataOffset, ExpOemCodePageDataOffset;
ULONG ExpUnicodeCaseTableDataOffset; ULONG ExpUnicodeCaseTableDataOffset;
PVOID ExpNlsSectionPointer; PVOID ExpNlsSectionPointer;
extern CHAR NtBuildLab[];
extern ULONG CmNtCSDVersion;
typedef struct _EXHANDLE typedef struct _EXHANDLE
{ {

View file

@ -968,6 +968,7 @@ extern GENERIC_MAPPING IopCompletionMapping;
extern GENERIC_MAPPING IopFileMapping; extern GENERIC_MAPPING IopFileMapping;
extern POBJECT_TYPE _IoFileObjectType; extern POBJECT_TYPE _IoFileObjectType;
extern HAL_DISPATCH _HalDispatchTable; extern HAL_DISPATCH _HalDispatchTable;
extern LIST_ENTRY IopErrorLogListHead;
// //
// Inlined Functions // Inlined Functions

View file

@ -126,7 +126,7 @@ extern LARGE_INTEGER KiTimeIncrementReciprocal;
extern UCHAR KiTimeIncrementShiftCount; extern UCHAR KiTimeIncrementShiftCount;
extern ULONG KiTimeLimitIsrMicroseconds; extern ULONG KiTimeLimitIsrMicroseconds;
extern ULONG KiServiceLimit; extern ULONG KiServiceLimit;
extern LIST_ENTRY BugcheckCallbackListHead, BugcheckReasonCallbackListHead; extern LIST_ENTRY KeBugcheckCallbackListHead, KeBugcheckReasonCallbackListHead;
extern KSPIN_LOCK BugCheckCallbackLock; extern KSPIN_LOCK BugCheckCallbackLock;
extern KDPC KiTimerExpireDpc; extern KDPC KiTimerExpireDpc;
extern KTIMER_TABLE_ENTRY KiTimerTableListHead[TIMER_TABLE_SIZE]; extern KTIMER_TABLE_ENTRY KiTimerTableListHead[TIMER_TABLE_SIZE];
@ -150,6 +150,8 @@ extern PVOID KeRaiseUserExceptionDispatcher;
extern UCHAR KiDebugRegisterTrapOffsets[9]; extern UCHAR KiDebugRegisterTrapOffsets[9];
extern UCHAR KiDebugRegisterContextOffsets[9]; extern UCHAR KiDebugRegisterContextOffsets[9];
extern ULONG KiFreezeFlag; extern ULONG KiFreezeFlag;
extern ULONG KeTimeIncrement;
extern PVOID KiBugCheckData;
/* MACROS *************************************************************************/ /* MACROS *************************************************************************/

View file

@ -503,8 +503,8 @@ extern ULONG ObpTraceLevel;
extern KEVENT ObpDefaultObject; extern KEVENT ObpDefaultObject;
extern POBJECT_TYPE ObpTypeObjectType; extern POBJECT_TYPE ObpTypeObjectType;
extern POBJECT_TYPE ObSymbolicLinkType; extern POBJECT_TYPE ObSymbolicLinkType;
extern POBJECT_TYPE ObTypeObjectType; extern POBJECT_TYPE ObpTypeObjectType;
extern POBJECT_DIRECTORY NameSpaceRoot; extern POBJECT_DIRECTORY ObpRootDirectoryObject;
extern POBJECT_DIRECTORY ObpTypeDirectoryObject; extern POBJECT_DIRECTORY ObpTypeDirectoryObject;
extern PHANDLE_TABLE ObpKernelHandleTable; extern PHANDLE_TABLE ObpKernelHandleTable;
extern WORK_QUEUE_ITEM ObpReaperWorkItem; extern WORK_QUEUE_ITEM ObpReaperWorkItem;

View file

@ -23,7 +23,7 @@ typedef struct _IOP_ERROR_LOG_WORKER_DPC
/* GLOBALS *******************************************************************/ /* GLOBALS *******************************************************************/
LONG IopTotalLogSize; LONG IopTotalLogSize;
LIST_ENTRY IopLogListHead; LIST_ENTRY IopErrorLogListHead;
KSPIN_LOCK IopLogListLock; KSPIN_LOCK IopLogListLock;
BOOLEAN IopLogWorkerRunning; BOOLEAN IopLogWorkerRunning;
@ -59,7 +59,7 @@ IopGetErrorLogEntry(VOID)
/* Acquire the lock and check if the list is empty */ /* Acquire the lock and check if the list is empty */
KeAcquireSpinLock(&IopLogListLock, &OldIrql); KeAcquireSpinLock(&IopLogListLock, &OldIrql);
if (IsListEmpty(&IopLogListHead)) if (IsListEmpty(&IopErrorLogListHead))
{ {
/* List is empty, disable the worker and return NULL */ /* List is empty, disable the worker and return NULL */
IopLogWorkerRunning = FALSE; IopLogWorkerRunning = FALSE;
@ -68,7 +68,7 @@ IopGetErrorLogEntry(VOID)
else else
{ {
/* Otherwise, remove an entry */ /* Otherwise, remove an entry */
ListEntry = RemoveHeadList(&IopLogListHead); ListEntry = RemoveHeadList(&IopErrorLogListHead);
} }
/* Release the lock and return the entry */ /* Release the lock and return the entry */
@ -420,7 +420,7 @@ IopLogWorker(IN PVOID Parameter)
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
/* Requeue log message and restart the worker */ /* Requeue log message and restart the worker */
ExInterlockedInsertTailList(&IopLogListHead, ExInterlockedInsertTailList(&IopErrorLogListHead,
&LogEntry->ListEntry, &LogEntry->ListEntry,
&IopLogListLock); &IopLogListLock);
IopLogWorkerRunning = FALSE; IopLogWorkerRunning = FALSE;
@ -581,7 +581,7 @@ IoWriteErrorLogEntry(IN PVOID ElEntry)
/* Acquire the lock and insert this write in the list */ /* Acquire the lock and insert this write in the list */
KeAcquireSpinLock(&IopLogListLock, &Irql); KeAcquireSpinLock(&IopLogListLock, &Irql);
InsertHeadList(&IopLogListHead, &LogEntry->ListEntry); InsertHeadList(&IopErrorLogListHead, &LogEntry->ListEntry);
/* Check if the worker is runnign */ /* Check if the worker is runnign */
if (!IopLogWorkerRunning) if (!IopLogWorkerRunning)

View file

@ -70,7 +70,7 @@ extern LIST_ENTRY DriverBootReinitListHead;
extern LIST_ENTRY DriverReinitListHead; extern LIST_ENTRY DriverReinitListHead;
extern LIST_ENTRY PnpNotifyListHead; extern LIST_ENTRY PnpNotifyListHead;
extern LIST_ENTRY FsChangeNotifyListHead; extern LIST_ENTRY FsChangeNotifyListHead;
extern LIST_ENTRY IopLogListHead; extern LIST_ENTRY IopErrorLogListHead;
extern LIST_ENTRY IopTimerQueueHead; extern LIST_ENTRY IopTimerQueueHead;
extern KDPC IopTimerDpc; extern KDPC IopTimerDpc;
extern KTIMER IopTimer; extern KTIMER IopTimer;
@ -467,7 +467,7 @@ IoInitSystem(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
InitializeListHead(&PnpNotifyListHead); InitializeListHead(&PnpNotifyListHead);
InitializeListHead(&ShutdownListHead); InitializeListHead(&ShutdownListHead);
InitializeListHead(&FsChangeNotifyListHead); InitializeListHead(&FsChangeNotifyListHead);
InitializeListHead(&IopLogListHead); InitializeListHead(&IopErrorLogListHead);
KeInitializeSpinLock(&CancelSpinLock); KeInitializeSpinLock(&CancelSpinLock);
KeInitializeSpinLock(&IoVpbLock); KeInitializeSpinLock(&IoVpbLock);
KeInitializeSpinLock(&IoStatisticsLock); KeInitializeSpinLock(&IoStatisticsLock);

View file

@ -12,6 +12,8 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
VOID NTAPI RtlpBreakWithStatusInstruction(VOID);
/* GLOBALS *******************************************************************/ /* GLOBALS *******************************************************************/
// //
@ -35,13 +37,6 @@ DBGKD_GET_VERSION64 KdVersionBlock =
0 0
}; };
//
// Debugger Data
//
KDDEBUGGER_DATA64 KdDebuggerDataBlock;
LIST_ENTRY KdpDebuggerDataListHead;
KSPIN_LOCK KdpDataSpinLock;
// //
// Debugger State // Debugger State
// //
@ -88,6 +83,16 @@ LARGE_INTEGER KdTimerStop, KdTimerStart, KdTimerDifference;
CHAR KdpMessageBuffer[4096]; CHAR KdpMessageBuffer[4096];
CHAR KdpPathBuffer[4096]; CHAR KdpPathBuffer[4096];
//
// KdPrint Buffers
//
CHAR KdPrintDefaultCircularBuffer[0x8000];
PCHAR KdPrintWritePointer = KdPrintDefaultCircularBuffer;
ULONG KdPrintRolloverCount;
PCHAR KdPrintCircularBuffer = KdPrintDefaultCircularBuffer;
ULONG KdPrintBufferSize = sizeof(KdPrintDefaultCircularBuffer);
ULONG KdPrintBufferChanges = 0;
// //
// Debug Filter Masks // Debug Filter Masks
// //
@ -309,3 +314,143 @@ PULONG KdComponentTable[104] =
}; };
ULONG KdComponentTableSize = sizeof(KdComponentTable); ULONG KdComponentTableSize = sizeof(KdComponentTable);
//
// Debugger Data
//
LIST_ENTRY KdpDebuggerDataListHead;
KSPIN_LOCK KdpDataSpinLock;
KDDEBUGGER_DATA64 KdDebuggerDataBlock =
{
{{0}},
0,
{PtrToUlong(RtlpBreakWithStatusInstruction)},
0,
FIELD_OFFSET(KTHREAD, CallbackStack),
CBSTACK_CALLBACK_STACK,
CBSTACK_EBP,
0,
{PtrToUlong(KiCallUserMode)},
{0},
{PtrToUlong(&PsLoadedModuleList)},
{PtrToUlong(&PsActiveProcessHead)},
{PtrToUlong(&PspCidTable)},
{PtrToUlong(&ExpSystemResourcesList)},
{0}, // ExpPagedPoolDescriptor
{0}, // ExpNumberOfPagedPools
{PtrToUlong(&KeTimeIncrement)},
{PtrToUlong(&KeBugcheckCallbackListHead)},
{PtrToUlong(&KiBugCheckData)},
{PtrToUlong(&IopErrorLogListHead)},
{PtrToUlong(&ObpRootDirectoryObject)},
{PtrToUlong(&ObpTypeObjectType)},
{0}, // MmSystemCacheStart
{0}, // MmSystemCacheEnd
{0}, // MmSystemCacheWs
{0}, // MmPfnDatabase
{0}, // MmSystemPtesStart
{0}, // 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
PAGE_SIZE,
{0}, // MmSizeOfPagedPoolInBytes
{0}, // MmTotalCommitLimit
{0}, // MmTotalCommittedPages
{0}, // MmSharedCommit
{0}, // MmDriverCommit
{0}, // MmProcessCommit
{0}, // MmPagedPoolCommit
{0},
{0}, // MmZeroedPageListHead
{0}, // MmFreePageListHead
{0}, // MmStandbyPageListHead
{0}, // MmModifiedPageListHead
{0}, // MmModifiedNoWritePageListHead
{0}, // MmAvailablePages
{0}, // MmResidentAvailablePages
{0}, // PoolTrackTable
{0}, // NonPagedPoolDescriptor
{PtrToUlong(&MmHighestUserAddress)},
{PtrToUlong(&MmSystemRangeStart)},
{PtrToUlong(&MmUserProbeAddress)},
{PtrToUlong(KdPrintDefaultCircularBuffer)},
{PtrToUlong(KdPrintDefaultCircularBuffer + 1)},
{PtrToUlong(&KdPrintWritePointer)},
{PtrToUlong(&KdPrintRolloverCount)},
{0}, // MmLoadedUserImageList
{PtrToUlong(&NtBuildLab)},
{0},
{PtrToUlong(KiProcessorBlock)},
{0}, // MmUnloadedDrivers
{0}, // MmLastUnloadedDrivers
{0}, // MmTriageActionTaken
{0}, // MmSpecialPoolTag
{0}, // KernelVerifier
{0}, // MmVerifierData
{0}, // MmAllocatedNonPagedPool
{0}, // MmPeakCommitment
{0}, // MmtotalCommitLimitMaximum
{PtrToUlong(&CmNtCSDVersion)},
{0}, // MmPhysicalMemoryBlock
{0}, // MmSessionBase
{0}, // MmSessionSize
{0},
{0},
FIELD_OFFSET(KTHREAD, NextProcessor),
FIELD_OFFSET(KTHREAD, Teb),
FIELD_OFFSET(KTHREAD, KernelStack),
FIELD_OFFSET(KTHREAD, InitialStack),
FIELD_OFFSET(KTHREAD, ApcState.Process),
FIELD_OFFSET(KTHREAD, State),
0,
0,
sizeof(EPROCESS),
FIELD_OFFSET(EPROCESS, Peb),
FIELD_OFFSET(EPROCESS, InheritedFromUniqueProcessId),
FIELD_OFFSET(EPROCESS, Pcb.DirectoryTableBase),
sizeof(KPRCB),
FIELD_OFFSET(KPRCB, DpcRoutineActive),
FIELD_OFFSET(KPRCB, CurrentThread),
FIELD_OFFSET(KPRCB, MHz),
FIELD_OFFSET(KPRCB, CpuType),
FIELD_OFFSET(KPRCB, VendorString),
FIELD_OFFSET(KPRCB, ProcessorState.ContextFrame),
FIELD_OFFSET(KPRCB, Number),
sizeof(ETHREAD),
{PtrToUlong(KdPrintDefaultCircularBuffer)},
{PtrToUlong(&KdPrintBufferSize)},
{PtrToUlong(&KeLoaderBlock)},
sizeof(KIPCR) + sizeof(KPRCB),
FIELD_OFFSET(KIPCR, Self),
FIELD_OFFSET(KPCR, Prcb),
FIELD_OFFSET(KIPCR, PrcbData),
0,
0,
0,
0,
0,
FIELD_OFFSET(KIPCR, PrcbData) +
FIELD_OFFSET(KPRCB, ProcessorState.SpecialRegisters),
KGDT_R0_CODE,
KGDT_R0_DATA,
KGDT_R0_PCR,
KGDT_R3_CODE,
KGDT_R3_DATA,
KGDT_R3_TEB,
KGDT_LDT,
KGDT_TSS,
0,
0,
{0}, // IopNumTriagDumpDataBlocks
{0}, // IopTriageDumpDataBlocks
};

View file

@ -18,8 +18,8 @@
/* GLOBALS *******************************************************************/ /* GLOBALS *******************************************************************/
LIST_ENTRY BugcheckCallbackListHead; LIST_ENTRY KeBugcheckCallbackListHead;
LIST_ENTRY BugcheckReasonCallbackListHead; LIST_ENTRY KeBugcheckReasonCallbackListHead;
KSPIN_LOCK BugCheckCallbackLock; KSPIN_LOCK BugCheckCallbackLock;
ULONG KeBugCheckActive, KeBugCheckOwner; ULONG KeBugCheckActive, KeBugCheckOwner;
LONG KeBugCheckOwnerRecursionCount; LONG KeBugCheckOwnerRecursionCount;
@ -209,7 +209,7 @@ KiDoBugCheckCallbacks(VOID)
ULONG_PTR Checksum; ULONG_PTR Checksum;
/* First make sure that the list is Initialized... it might not be */ /* First make sure that the list is Initialized... it might not be */
ListHead = &BugcheckCallbackListHead; ListHead = &KeBugcheckCallbackListHead;
if ((ListHead->Flink) && (ListHead->Blink)) if ((ListHead->Flink) && (ListHead->Blink))
{ {
/* Loop the list */ /* Loop the list */
@ -1033,7 +1033,7 @@ KeRegisterBugCheckCallback(IN PKBUGCHECK_CALLBACK_RECORD CallbackRecord,
CallbackRecord->Component = Component; CallbackRecord->Component = Component;
CallbackRecord->CallbackRoutine = CallbackRoutine; CallbackRecord->CallbackRoutine = CallbackRoutine;
CallbackRecord->State = BufferInserted; CallbackRecord->State = BufferInserted;
InsertTailList(&BugcheckCallbackListHead, &CallbackRecord->Entry); InsertTailList(&KeBugcheckCallbackListHead, &CallbackRecord->Entry);
Status = TRUE; Status = TRUE;
} }
@ -1067,7 +1067,7 @@ KeRegisterBugCheckReasonCallback(
CallbackRecord->CallbackRoutine = CallbackRoutine; CallbackRecord->CallbackRoutine = CallbackRoutine;
CallbackRecord->State = BufferInserted; CallbackRecord->State = BufferInserted;
CallbackRecord->Reason = Reason; CallbackRecord->Reason = Reason;
InsertTailList(&BugcheckReasonCallbackListHead, InsertTailList(&KeBugcheckReasonCallbackListHead,
&CallbackRecord->Entry); &CallbackRecord->Entry);
Status = TRUE; Status = TRUE;
} }

View file

@ -62,8 +62,8 @@ KiInitSystem(VOID)
ULONG i; ULONG i;
/* Initialize Bugcheck Callback data */ /* Initialize Bugcheck Callback data */
InitializeListHead(&BugcheckCallbackListHead); InitializeListHead(&KeBugcheckCallbackListHead);
InitializeListHead(&BugcheckReasonCallbackListHead); InitializeListHead(&KeBugcheckReasonCallbackListHead);
KeInitializeSpinLock(&BugCheckCallbackLock); KeInitializeSpinLock(&BugCheckCallbackLock);
/* Initialize the Timer Expiration DPC */ /* Initialize the Timer Expiration DPC */

View file

@ -198,7 +198,7 @@ ObInit(VOID)
ObjectTypeInitializer.GenericMapping = ObpTypeMapping; ObjectTypeInitializer.GenericMapping = ObpTypeMapping;
ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(OBJECT_TYPE); ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(OBJECT_TYPE);
ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK; ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ObTypeObjectType); ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ObpTypeObjectType);
/* Create the Directory Type */ /* Create the Directory Type */
RtlInitUnicodeString(&Name, L"Directory"); RtlInitUnicodeString(&Name, L"Directory");
@ -247,7 +247,7 @@ ObPostPhase0:
0, 0,
ObDirectoryType, ObDirectoryType,
KernelMode, KernelMode,
(PVOID*)&NameSpaceRoot, (PVOID*)&ObpRootDirectoryObject,
NULL); NULL);
if (!NT_SUCCESS(Status)) return FALSE; if (!NT_SUCCESS(Status)) return FALSE;
@ -289,7 +289,7 @@ ObPostPhase0:
ObpAcquireDirectoryLockExclusive(ObpTypeDirectoryObject, &Context); ObpAcquireDirectoryLockExclusive(ObpTypeDirectoryObject, &Context);
/* Loop the object types */ /* Loop the object types */
ListHead = &ObTypeObjectType->TypeList; ListHead = &ObpTypeObjectType->TypeList;
NextEntry = ListHead->Flink; NextEntry = ListHead->Flink;
while (ListHead != NextEntry) while (ListHead != NextEntry)
{ {

View file

@ -19,7 +19,7 @@
extern ULONG NtGlobalFlag; extern ULONG NtGlobalFlag;
POBJECT_TYPE ObTypeObjectType = NULL; POBJECT_TYPE ObpTypeObjectType = NULL;
KEVENT ObpDefaultObject; KEVENT ObpDefaultObject;
NPAGED_LOOKASIDE_LIST ObpNmLookasideList, ObpCiLookasideList; NPAGED_LOOKASIDE_LIST ObpNmLookasideList, ObpCiLookasideList;
@ -1074,7 +1074,7 @@ ObCreateObjectType(IN PUNICODE_STRING TypeName,
/* Allocate the Object */ /* Allocate the Object */
Status = ObpAllocateObject(NULL, Status = ObpAllocateObject(NULL,
&ObjectName, &ObjectName,
ObTypeObjectType, ObpTypeObjectType,
sizeof(OBJECT_TYPE), sizeof(OBJECT_TYPE),
KernelMode, KernelMode,
(POBJECT_HEADER*)&Header); (POBJECT_HEADER*)&Header);
@ -1098,11 +1098,11 @@ ObCreateObjectType(IN PUNICODE_STRING TypeName,
LocalObjectType->HighWaterNumberOfHandles = 0; LocalObjectType->HighWaterNumberOfHandles = 0;
/* Check if this is the first Object Type */ /* Check if this is the first Object Type */
if (!ObTypeObjectType) if (!ObpTypeObjectType)
{ {
/* It is, so set this as the type object */ /* It is, so set this as the type object */
ObTypeObjectType = LocalObjectType; ObpTypeObjectType = LocalObjectType;
Header->Type = ObTypeObjectType; Header->Type = ObpTypeObjectType;
/* Set the hard-coded key and object count */ /* Set the hard-coded key and object count */
LocalObjectType->TotalNumberOfObjects = 1; LocalObjectType->TotalNumberOfObjects = 1;
@ -1195,11 +1195,11 @@ ObCreateObjectType(IN PUNICODE_STRING TypeName,
/* Get creator info and insert it into the type list */ /* Get creator info and insert it into the type list */
CreatorInfo = OBJECT_HEADER_TO_CREATOR_INFO(Header); CreatorInfo = OBJECT_HEADER_TO_CREATOR_INFO(Header);
if (CreatorInfo) InsertTailList(&ObTypeObjectType->TypeList, if (CreatorInfo) InsertTailList(&ObpTypeObjectType->TypeList,
&CreatorInfo->TypeList); &CreatorInfo->TypeList);
/* Set the index and the entry into the object type array */ /* Set the index and the entry into the object type array */
LocalObjectType->Index = ObTypeObjectType->TotalNumberOfObjects; LocalObjectType->Index = ObpTypeObjectType->TotalNumberOfObjects;
if (LocalObjectType->Index < 32) if (LocalObjectType->Index < 32)
{ {
/* It fits, insert it */ /* It fits, insert it */

View file

@ -16,7 +16,7 @@
#include <debug.h> #include <debug.h>
BOOLEAN ObpCaseInsensitive = TRUE; BOOLEAN ObpCaseInsensitive = TRUE;
POBJECT_DIRECTORY NameSpaceRoot; POBJECT_DIRECTORY ObpRootDirectoryObject;
POBJECT_DIRECTORY ObpTypeDirectoryObject; POBJECT_DIRECTORY ObpTypeDirectoryObject;
/* DOS Device Prefix \??\ and \?? */ /* DOS Device Prefix \??\ and \?? */
@ -407,7 +407,7 @@ ObpLookupObjectName(IN HANDLE RootHandle OPTIONAL,
{ {
/* Reparsed to the root directory, so start over */ /* Reparsed to the root directory, so start over */
ObDereferenceObject(RootDirectory); ObDereferenceObject(RootDirectory);
RootDirectory = NameSpaceRoot; RootDirectory = ObpRootDirectoryObject;
/* Don't use this anymore, since we're starting at root */ /* Don't use this anymore, since we're starting at root */
RootHandle = NULL; RootHandle = NULL;
@ -448,7 +448,7 @@ ObpLookupObjectName(IN HANDLE RootHandle OPTIONAL,
else else
{ {
/* We did not get a Root Directory, so use the root */ /* We did not get a Root Directory, so use the root */
RootDirectory = NameSpaceRoot; RootDirectory = ObpRootDirectoryObject;
/* It must start with a path separator */ /* It must start with a path separator */
if (!(ObjectName->Length) || if (!(ObjectName->Length) ||
@ -811,7 +811,7 @@ ReparseObject:
/* Start at Root */ /* Start at Root */
ParentDirectory = NULL; ParentDirectory = NULL;
RootDirectory = NameSpaceRoot; RootDirectory = ObpRootDirectoryObject;
/* Check for reparse status */ /* Check for reparse status */
if (Status == STATUS_REPARSE_OBJECT) if (Status == STATUS_REPARSE_OBJECT)
@ -838,7 +838,7 @@ ReparseObject:
goto ParseFromRoot; goto ParseFromRoot;
} }
} }
else if (RootDirectory == NameSpaceRoot) else if (RootDirectory == ObpRootDirectoryObject)
{ {
/* We got STATUS_REPARSE but are at the Root Directory */ /* We got STATUS_REPARSE but are at the Root Directory */
Object = NULL; Object = NULL;
@ -1025,7 +1025,7 @@ ObQueryNameString(IN PVOID Object,
* enough right at the beginning, not work our way through * enough right at the beginning, not work our way through
* and find out at the end * and find out at the end
*/ */
if (Object == NameSpaceRoot) if (Object == ObpRootDirectoryObject)
{ {
/* Size of the '\' string */ /* Size of the '\' string */
NameSize = sizeof(OBJ_NAME_PATH_SEPARATOR); NameSize = sizeof(OBJ_NAME_PATH_SEPARATOR);
@ -1037,7 +1037,7 @@ ObQueryNameString(IN PVOID Object,
NameSize = sizeof(OBJ_NAME_PATH_SEPARATOR) + LocalInfo->Name.Length; NameSize = sizeof(OBJ_NAME_PATH_SEPARATOR) + LocalInfo->Name.Length;
/* Loop inside the directory to get the top-most one (meaning root) */ /* Loop inside the directory to get the top-most one (meaning root) */
while ((ParentDirectory != NameSpaceRoot) && (ParentDirectory)) while ((ParentDirectory != ObpRootDirectoryObject) && (ParentDirectory))
{ {
/* Get the Name Information */ /* Get the Name Information */
LocalInfo = OBJECT_HEADER_TO_NAME_INFO( LocalInfo = OBJECT_HEADER_TO_NAME_INFO(
@ -1080,7 +1080,7 @@ ObQueryNameString(IN PVOID Object,
*--ObjectName = UNICODE_NULL; *--ObjectName = UNICODE_NULL;
/* Check if the object is actually the Root directory */ /* Check if the object is actually the Root directory */
if (Object == NameSpaceRoot) if (Object == ObpRootDirectoryObject)
{ {
/* This is already the Root Directory, return "\\" */ /* This is already the Root Directory, return "\\" */
*--ObjectName = OBJ_NAME_PATH_SEPARATOR; *--ObjectName = OBJ_NAME_PATH_SEPARATOR;
@ -1101,7 +1101,7 @@ ObQueryNameString(IN PVOID Object,
/* Now parse the Parent directories until we reach the top */ /* Now parse the Parent directories until we reach the top */
ParentDirectory = LocalInfo->Directory; ParentDirectory = LocalInfo->Directory;
while ((ParentDirectory != NameSpaceRoot) && (ParentDirectory)) while ((ParentDirectory != ObpRootDirectoryObject) && (ParentDirectory))
{ {
/* Get the name information */ /* Get the name information */
LocalInfo = OBJECT_HEADER_TO_NAME_INFO( LocalInfo = OBJECT_HEADER_TO_NAME_INFO(