Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

kddata.c

Go to the documentation of this file.
00001 /*++ 00002 00003 Copyright (c) 1990 Microsoft Corporation 00004 00005 Module Name: 00006 00007 kddata.c 00008 00009 Abstract: 00010 00011 This module contains global data for the portable kernel debgger. 00012 00013 Author: 00014 00015 Mark Lucovsky 1-Nov-1993 00016 00017 Revision History: 00018 00019 --*/ 00020 00021 #include "kdp.h" 00022 #include "ke.h" 00023 #include "pool.h" 00024 #include "stdio.h" 00025 00026 00027 // 00028 // Miscellaneous data from all over the kernel 00029 // 00030 00031 00032 extern ULONG KiBugCheckData[]; 00033 00034 extern PHANDLE_TABLE PspCidTable; 00035 00036 extern LIST_ENTRY ExpSystemResourcesList; 00037 extern PPOOL_DESCRIPTOR ExpPagedPoolDescriptor; 00038 extern ULONG ExpNumberOfPagedPools; 00039 00040 extern ULONG KeTimeIncrement; 00041 extern LIST_ENTRY KeBugCheckCallbackListHead; 00042 extern ULONG KiBugcheckData[]; 00043 00044 extern LIST_ENTRY IopErrorLogListHead; 00045 00046 extern POBJECT_DIRECTORY ObpRootDirectoryObject; 00047 extern POBJECT_TYPE ObpTypeObjectType; 00048 00049 extern PVOID MmSystemCacheStart; 00050 extern PVOID MmSystemCacheEnd; 00051 00052 extern PVOID MmPfnDatabase; 00053 extern ULONG MmSystemPtesStart[]; 00054 extern ULONG MmSystemPtesEnd[]; 00055 extern ULONG MmSubsectionBase; 00056 extern ULONG MmNumberOfPagingFiles; 00057 00058 extern ULONG MmLowestPhysicalPage; 00059 extern ULONG MmHighestPhysicalPage; 00060 extern PFN_COUNT MmNumberOfPhysicalPages; 00061 00062 extern ULONG MmMaximumNonPagedPoolInBytes; 00063 extern PVOID MmNonPagedSystemStart; 00064 extern PVOID MmNonPagedPoolStart; 00065 extern PVOID MmNonPagedPoolEnd; 00066 00067 extern PVOID MmPagedPoolStart; 00068 extern PVOID MmPagedPoolEnd; 00069 extern ULONG MmPagedPoolInfo[]; 00070 extern ULONG MmSizeOfPagedPoolInBytes; 00071 00072 extern ULONG MmTotalCommitLimit; 00073 extern ULONG MmTotalCommittedPages; 00074 extern ULONG MmSharedCommit; 00075 extern ULONG MmDriverCommit; 00076 extern ULONG MmProcessCommit; 00077 extern ULONG MmPagedPoolCommit; 00078 extern ULONG MmExtendedCommit; 00079 00080 extern MMPFNLIST MmZeroedPageListHead; 00081 extern MMPFNLIST MmFreePageListHead; 00082 extern MMPFNLIST MmStandbyPageListHead; 00083 extern MMPFNLIST MmModifiedPageListHead; 00084 extern MMPFNLIST MmModifiedNoWritePageListHead; 00085 extern ULONG MmAvailablePages; 00086 extern LONG MmResidentAvailablePages; 00087 extern LIST_ENTRY MmLoadedUserImageList; 00088 00089 extern PPOOL_TRACKER_TABLE PoolTrackTable; 00090 extern POOL_DESCRIPTOR NonPagedPoolDescriptor; 00091 00092 00093 #ifdef _X86_ 00094 #ifdef ALLOC_PRAGMA 00095 #pragma data_seg("PAGEKD") 00096 #endif 00097 #endif // _X86_ 00098 00099 00100 00101 UCHAR KdPrintCircularBuffer[KDPRINTBUFFERSIZE] = {0}; 00102 PUCHAR KdPrintWritePointer = KdPrintCircularBuffer; 00103 ULONG KdPrintRolloverCount = 0; 00104 KSPIN_LOCK KdpPrintSpinLock = 0; 00105 00106 KDDEBUGGER_DATA KdDebuggerDataBlock = { 00107 {0}, // DBGKD_DEBUG_DATA_HEADER Header; 00108 0, // ULONG KernBase; 00109 (ULONG_PTR)RtlpBreakWithStatusInstruction, // ULONG BreakpointWithStatus; 00110 0, // ULONG SavedContext; 00111 0, // USHORT ThCallbackStack; 00112 FIELD_OFFSET(KCALLOUT_FRAME, CbStk), // USHORT NextCallback; 00113 #if defined(_X86_) 00114 FIELD_OFFSET(KCALLOUT_FRAME, Ebp), 00115 #else 00116 0, // USHORT FramePointer; 00117 #endif 00118 00119 #if defined(_X86PAE_) 00120 1, 00121 #else 00122 0, // USHORT PaeEnabled; 00123 #endif 00124 (ULONG_PTR)KiCallUserMode, // ULONG KiCallUserMode; 00125 0, // ULONG KeUserCallbackDispatcher; 00126 00127 (ULONG_PTR)&PsLoadedModuleList, // ULONG_PTR PsLoadedModuleList; 00128 (ULONG_PTR)&PsActiveProcessHead, // ULONG_PTR PsActiveProcessHead; 00129 (ULONG_PTR)&PspCidTable, // ULONG_PTR PspCidTable; 00130 00131 (ULONG_PTR)&ExpSystemResourcesList, // ULONG_PTR ExpSystemResourcesList; 00132 (ULONG_PTR)&ExpPagedPoolDescriptor, // ULONG_PTR ExpPagedPoolDescriptor; 00133 (ULONG_PTR)&ExpNumberOfPagedPools, // ULONG_PTR ExpNumberOfPagedPools; 00134 00135 (ULONG_PTR)&KeTimeIncrement, // ULONG_PTR KeTimeIncrement; 00136 (ULONG_PTR)&KeBugCheckCallbackListHead, // ULONG_PTR KeBugCheckCallbackListHead; 00137 (ULONG_PTR)KiBugCheckData, // ULONG_PTR KiBugcheckData; 00138 00139 (ULONG_PTR)&IopErrorLogListHead, // ULONG_PTR IopErrorLogListHead; 00140 00141 (ULONG_PTR)&ObpRootDirectoryObject, // ULONG_PTR ObpRootDirectoryObject; 00142 (ULONG_PTR)&ObpTypeObjectType, // ULONG_PTR ObpTypeObjectType; 00143 00144 (ULONG_PTR)&MmSystemCacheStart, // ULONG_PTR MmSystemCacheStart; 00145 (ULONG_PTR)&MmSystemCacheEnd, // ULONG_PTR MmSystemCacheEnd; 00146 (ULONG_PTR)&MmSystemCacheWs, // ULONG_PTR MmSystemCacheWs; 00147 00148 (ULONG_PTR)&MmPfnDatabase, // ULONG_PTR MmPfnDatabase; 00149 (ULONG_PTR)MmSystemPtesStart, // ULONG_PTR MmSystemPtesStart; 00150 (ULONG_PTR)MmSystemPtesEnd, // ULONG_PTR MmSystemPtesEnd; 00151 (ULONG_PTR)&MmSubsectionBase, // ULONG_PTR MmSubsectionBase; 00152 (ULONG_PTR)&MmNumberOfPagingFiles, // ULONG_PTR MmNumberOfPagingFiles; 00153 00154 (ULONG_PTR)&MmLowestPhysicalPage, // ULONG_PTR MmLowestPhysicalPage; 00155 (ULONG_PTR)&MmHighestPhysicalPage, // ULONG_PTR MmHighestPhysicalPage; 00156 (ULONG_PTR)&MmNumberOfPhysicalPages, // ULONG_PTR MmNumberOfPhysicalPages; 00157 00158 (ULONG_PTR)&MmMaximumNonPagedPoolInBytes, // ULONG_PTR MmMaximumNonPagedPoolInBytes; 00159 (ULONG_PTR)&MmNonPagedSystemStart, // ULONG_PTR MmNonPagedSystemStart; 00160 (ULONG_PTR)&MmNonPagedPoolStart, // ULONG_PTR MmNonPagedPoolStart; 00161 (ULONG_PTR)&MmNonPagedPoolEnd, // ULONG_PTR MmNonPagedPoolEnd; 00162 00163 (ULONG_PTR)&MmPagedPoolStart, // ULONG_PTR MmPagedPoolStart; 00164 (ULONG_PTR)&MmPagedPoolEnd, // ULONG_PTR MmPagedPoolEnd; 00165 (ULONG_PTR)&MmPagedPoolInfo, // ULONG_PTR MmPagedPoolInformation; 00166 0, // ULONG Unused2 00167 (ULONG_PTR)&MmSizeOfPagedPoolInBytes, // ULONG_PTR MmSizeOfPagedPoolInBytes; 00168 00169 (ULONG_PTR)&MmTotalCommitLimit, // ULONG_PTR MmTotalCommitLimit; 00170 (ULONG_PTR)&MmTotalCommittedPages, // ULONG_PTR MmTotalCommittedPages; 00171 (ULONG_PTR)&MmSharedCommit, // ULONG_PTR MmSharedCommit; 00172 (ULONG_PTR)&MmDriverCommit, // ULONG_PTR MmDriverCommit; 00173 (ULONG_PTR)&MmProcessCommit, // ULONG_PTR MmProcessCommit; 00174 (ULONG_PTR)&MmPagedPoolCommit, // ULONG_PTR MmPagedPoolCommit; 00175 (ULONG_PTR)&MmExtendedCommit, // ULONG_PTR MmExtendedCommit; 00176 00177 (ULONG_PTR)&MmZeroedPageListHead, // ULONG_PTR MmZeroedPageListHead; 00178 (ULONG_PTR)&MmFreePageListHead, // ULONG_PTR MmFreePageListHead; 00179 (ULONG_PTR)&MmStandbyPageListHead, // ULONG_PTR MmStandbyPageListHead; 00180 (ULONG_PTR)&MmModifiedPageListHead, // ULONG_PTR MmModifiedPageListHead; 00181 (ULONG_PTR)&MmModifiedNoWritePageListHead, // ULONG_PTR MmModifiedNoWritePageListHead; 00182 (ULONG_PTR)&MmAvailablePages, // ULONG_PTR MmAvailablePages; 00183 (ULONG_PTR)&MmResidentAvailablePages, // ULONG_PTR MmResidentAvailablePages; 00184 00185 (ULONG_PTR)&PoolTrackTable, // ULONG_PTR PoolTrackTable; 00186 (ULONG_PTR)&NonPagedPoolDescriptor, // ULONG_PTR NonPagedPoolDescriptor; 00187 00188 (ULONG_PTR)&MmHighestUserAddress, // ULONG_PTR MmHighestUserAddress; 00189 (ULONG_PTR)&MmSystemRangeStart, // ULONG_PTR MmSystemRangeStart; 00190 (ULONG_PTR)&MmUserProbeAddress, // ULONG_PTR MmUserProbeAddress; 00191 00192 (ULONG_PTR) KdPrintCircularBuffer, // ULONG_PTR KdPrintCircularBuffer; 00193 (ULONG_PTR) KdPrintCircularBuffer+sizeof(KdPrintCircularBuffer), 00194 // ULONG_PTR KdPrintCircularBufferEnd; 00195 (ULONG_PTR) &KdPrintWritePointer, // ULONG_PTR KdPrintWritePointer; 00196 (ULONG_PTR) &KdPrintRolloverCount, // ULONG_PTR KdPrintRolloverCount; 00197 (ULONG_PTR) &MmLoadedUserImageList, // ULONG_PTR MmLoadedUserImageList; 00198 }; 00199 00200 00201 BREAKPOINT_ENTRY KdpBreakpointTable[BREAKPOINT_TABLE_SIZE] = {0}; 00202 UCHAR KdpMessageBuffer[KDP_MESSAGE_BUFFER_SIZE] = {0}; 00203 UCHAR KdpPathBuffer[KDP_MESSAGE_BUFFER_SIZE] = {0}; 00204 DBGKD_INTERNAL_BREAKPOINT KdpInternalBPs[DBGKD_MAX_INTERNAL_BREAKPOINTS] = {0}; 00205 00206 LARGE_INTEGER KdPerformanceCounterRate = {0,0}; 00207 LARGE_INTEGER KdTimerStart = {0,0} ; 00208 LARGE_INTEGER KdTimerStop = {0,0}; 00209 LARGE_INTEGER KdTimerDifference = {0,0}; 00210 00211 ULONG_PTR KdpCurrentSymbolStart = 0; 00212 ULONG_PTR KdpCurrentSymbolEnd = 0; 00213 LONG KdpNextCallLevelChange = 0; // used only over returns to the debugger. 00214 00215 ULONG_PTR KdSpecialCalls[DBGKD_MAX_SPECIAL_CALLS]; 00216 ULONG KdNumberOfSpecialCalls = 0; 00217 ULONG_PTR InitialSP = 0; 00218 ULONG KdpNumInternalBreakpoints = 0; 00219 KTIMER InternalBreakpointTimer = {0}; 00220 KDPC InternalBreakpointCheckDpc = {0}; 00221 00222 BOOLEAN KdpPortLocked = FALSE; 00223 00224 00225 DBGKD_TRACE_DATA TraceDataBuffer[TRACE_DATA_BUFFER_MAX_SIZE] = {0}; 00226 ULONG TraceDataBufferPosition = 1; // Element # to write next 00227 // Recall elt 0 is a length 00228 00229 TRACE_DATA_SYM TraceDataSyms[256] = {0}; 00230 UCHAR NextTraceDataSym = 0; // what's the next one to be replaced 00231 UCHAR NumTraceDataSyms = 0; // how many are valid? 00232 00233 ULONG IntBPsSkipping = 0; // number of exceptions that are being skipped 00234 // now 00235 00236 BOOLEAN WatchStepOver = FALSE; 00237 PVOID WSOThread = NULL; // thread doing stepover 00238 ULONG WSOEsp = 0; // stack pointer of thread doing stepover (yes, we need it) 00239 ULONG WatchStepOverHandle = 0; 00240 ULONG_PTR WatchStepOverBreakAddr = 0; // where the WatchStepOver break is set 00241 BOOLEAN WatchStepOverSuspended = FALSE; 00242 ULONG InstructionsTraced = 0; 00243 BOOLEAN SymbolRecorded = FALSE; 00244 LONG CallLevelChange = 0; 00245 LONG oldpc = 0; 00246 BOOLEAN InstrCountInternal = FALSE; // Processing a non-COUNTONLY? 00247 00248 BOOLEAN BreakpointsSuspended = FALSE; 00249 00250 // 00251 // KdpRetryCount controls the number of retries before we give up and 00252 // assume kernel debugger is not present. 00253 // KdpNumberRetries is the number of retries left. Initially, it is set 00254 // to 5 such that booting NT without debugger won't be delayed to long. 00255 // 00256 00257 ULONG KdpRetryCount = 5; 00258 ULONG KdpNumberRetries = 5; 00259 00260 BOOLEAN KdpControlCPending = FALSE; 00261 BOOLEAN KdpControlCPressed = FALSE; 00262 00263 KDP_BREAKPOINT_TYPE KdpBreakpointInstruction = {0}; 00264 ULONG KdpNextPacketIdToSend = 0; 00265 ULONG KdpPacketIdExpected = 0; 00266 PVOID KdpNtosImageBase = NULL; 00267 00268 // 00269 // KdDebugParameters contains the debug port address and baud rate 00270 // used to initialize kernel debugger port. 00271 // 00272 // (They both get initialized to zero to indicate using default settings.) 00273 // If SYSTEM hive contains the parameters, i.e. port and baud rate, system 00274 // init code will fill in these variable with the values stored in the hive. 00275 // 00276 00277 DEBUG_PARAMETERS KdDebugParameters = {0, 0}; 00278 00279 KSPIN_LOCK KdpDataSpinLock = 0; 00280 LIST_ENTRY KdpDebuggerDataListHead = {NULL,NULL}; 00281 00282 #ifdef _X86_ 00283 #ifdef ALLOC_PRAGMA 00284 #pragma data_seg() 00285 #endif 00286 #endif // _X86_ 00287 00288 KSPIN_LOCK KdpTimeSlipEventLock = 0; 00289 PVOID KdpTimeSlipEvent = NULL; 00290 KDPC KdpTimeSlipDpc = {0}; 00291 WORK_QUEUE_ITEM KdpTimeSlipWorkItem = {NULL}; 00292 KTIMER KdpTimeSlipTimer = {0}; 00293 ULONG KdpTimeSlipPending = 1; 00294 00295 00296 BOOLEAN KdDebuggerNotPresent = FALSE; 00297 BOOLEAN KdDebuggerEnabled = FALSE; 00298 BOOLEAN KdPitchDebugger = TRUE; 00299 BOOLEAN KdpDebuggerStructuresInitialized = FALSE ; 00300 ULONG KdpOweBreakpoint; 00301 ULONG KdEnteredDebugger = FALSE;

Generated on Sat May 15 19:40:34 2004 for test by doxygen 1.3.7