xref: /reactos/ntoskrnl/kd64/kddata.c (revision 72fd54a7)
1 /*
2  * PROJECT:         ReactOS Kernel
3  * LICENSE:         GPL - See COPYING in the top level directory
4  * FILE:            ntoskrnl/kd64/kddata.c
5  * PURPOSE:         Contains all global variables and settings for KD64
6  * PROGRAMMERS:     Alex Ionescu (alex.ionescu@reactos.org)
7  */
8 
9 /* INCLUDES ******************************************************************/
10 
11 #include <ntoskrnl.h>
12 #define NDEBUG
13 #include <debug.h>
14 #include <mm/ARM3/miarm.h>
15 #undef MmSystemRangeStart
16 
17 VOID NTAPI RtlpBreakWithStatusInstruction(VOID);
18 
19 //
20 // Apply the KIPCR WDK workaround for x86 and AMD64
21 //
22 #if defined(_M_IX86) || defined(_M_AMD64)
23 #define KPCR KIPCR
24 #endif
25 
26 #if defined(_M_IX86)
27 
28 #define KPCR_SELF_PCR_OFFSET           FIELD_OFFSET(KPCR, SelfPcr)
29 #define KPCR_CURRENT_PRCB_OFFSET       FIELD_OFFSET(KPCR, Prcb)
30 #define KPCR_CONTAINED_PRCB_OFFSET     FIELD_OFFSET(KPCR, PrcbData)
31 #define KPCR_INITIAL_STACK_OFFSET      0
32 #define KPCR_STACK_LIMIT_OFFSET        0
33 #define KPRCB_PCR_PAGE_OFFSET          0
34 #define CBSTACK_FRAME_POINTER          Ebp
35 
36 #elif defined(_M_AMD64)
37 
38 #define KPCR_SELF_PCR_OFFSET           FIELD_OFFSET(KPCR, Self)
39 #define KPCR_CURRENT_PRCB_OFFSET       FIELD_OFFSET(KPCR, CurrentPrcb)
40 #define KPCR_CONTAINED_PRCB_OFFSET     FIELD_OFFSET(KPCR, Prcb)
41 #define KPCR_INITIAL_STACK_OFFSET      0
42 #define KPCR_STACK_LIMIT_OFFSET        0
43 #define KPRCB_PCR_PAGE_OFFSET          0
44 #define CBSTACK_FRAME_POINTER          Rbp
45 
46 #elif defined(_M_ARM)
47 
48 #define KPCR_SELF_PCR_OFFSET           0
49 #define KPCR_CURRENT_PRCB_OFFSET       FIELD_OFFSET(KIPCR, Prcb)
50 #define KPCR_CONTAINED_PRCB_OFFSET     0
51 #define KPCR_INITIAL_STACK_OFFSET      FIELD_OFFSET(KPCR, InitialStack)
52 #define KPCR_STACK_LIMIT_OFFSET        FIELD_OFFSET(KPCR, StackLimit)
53 #define KPRCB_PCR_PAGE_OFFSET          FIELD_OFFSET(KPRCB, PcrPage)
54 #define CBSTACK_FRAME_POINTER          DummyFramePointer
55 
56 #else
57 #error Unsupported Architecture
58 #endif
59 
60 /* GLOBALS *******************************************************************/
61 
62 //
63 // Debugger State
64 //
65 KD_CONTEXT KdpContext;
66 BOOLEAN KdpPortLocked;
67 KSPIN_LOCK KdpDebuggerLock;
68 BOOLEAN KdpControlCPressed;
69 BOOLEAN KdpContextSent;
70 
71 //
72 // Debug Trap Handlers
73 //
74 PKDEBUG_ROUTINE KiDebugRoutine = KdpStub;
75 
76 //
77 // Debugger Configuration Settings
78 //
79 BOOLEAN KdBreakAfterSymbolLoad;
80 BOOLEAN KdPitchDebugger;
81 BOOLEAN KdDebuggerNotPresent;
82 BOOLEAN KdDebuggerEnabled;
83 BOOLEAN KdAutoEnableOnEvent;
84 BOOLEAN KdBlockEnable;
85 BOOLEAN KdIgnoreUmExceptions;
86 BOOLEAN KdPreviouslyEnabled;
87 BOOLEAN KdpDebuggerStructuresInitialized;
88 BOOLEAN KdEnteredDebugger;
89 ULONG KdDisableCount;
90 LARGE_INTEGER KdPerformanceCounterRate;
91 
92 //
93 // Breakpoint Data
94 //
95 BREAKPOINT_ENTRY KdpBreakpointTable[KD_BREAKPOINT_MAX];
96 KD_BREAKPOINT_TYPE KdpBreakpointInstruction = KD_BREAKPOINT_VALUE;
97 BOOLEAN KdpOweBreakpoint;
98 BOOLEAN BreakpointsSuspended;
99 ULONG KdpNumInternalBreakpoints;
100 
101 //
102 // Symbol Data
103 //
104 ULONG_PTR KdpCurrentSymbolStart, KdpCurrentSymbolEnd;
105 
106 //
107 // Tracepoint Data
108 //
109 ULONG TraceDataBuffer[40];
110 ULONG TraceDataBufferPosition = 1;
111 
112 //
113 // Time Slip Support
114 //
115 KDPC KdpTimeSlipDpc;
116 KTIMER KdpTimeSlipTimer;
117 WORK_QUEUE_ITEM KdpTimeSlipWorkItem;
118 LONG KdpTimeSlipPending = 1;
119 PKEVENT KdpTimeSlipEvent;
120 KSPIN_LOCK KdpTimeSlipEventLock;
121 LARGE_INTEGER KdTimerStop, KdTimerStart, KdTimerDifference;
122 
123 //
124 // Buffers
125 //
126 CHAR KdpMessageBuffer[KDP_MSG_BUFFER_SIZE];
127 CHAR KdpPathBuffer[KDP_MSG_BUFFER_SIZE];
128 
129 //
130 // KdPrint Buffers
131 //
132 CHAR KdPrintDefaultCircularBuffer[KD_DEFAULT_LOG_BUFFER_SIZE];
133 PCHAR KdPrintWritePointer = KdPrintDefaultCircularBuffer;
134 ULONG KdPrintRolloverCount;
135 PCHAR KdPrintCircularBuffer = KdPrintDefaultCircularBuffer;
136 ULONG KdPrintBufferSize = sizeof(KdPrintDefaultCircularBuffer);
137 ULONG KdPrintBufferChanges = 0;
138 KSPIN_LOCK KdpPrintSpinLock;
139 
140 //
141 // Debug Filter Masks
142 //
143 ULONG Kd_WIN2000_Mask = 1;
144 ULONG Kd_SYSTEM_Mask;
145 ULONG Kd_SMSS_Mask;
146 ULONG Kd_SETUP_Mask;
147 ULONG Kd_NTFS_Mask;
148 ULONG Kd_FSTUB_Mask;
149 ULONG Kd_CRASHDUMP_Mask;
150 ULONG Kd_CDAUDIO_Mask;
151 ULONG Kd_CDROM_Mask;
152 ULONG Kd_CLASSPNP_Mask;
153 ULONG Kd_DISK_Mask;
154 ULONG Kd_REDBOOK_Mask;
155 ULONG Kd_STORPROP_Mask;
156 ULONG Kd_SCSIPORT_Mask;
157 ULONG Kd_SCSIMINIPORT_Mask;
158 ULONG Kd_CONFIG_Mask;
159 ULONG Kd_I8042PRT_Mask;
160 ULONG Kd_SERMOUSE_Mask;
161 ULONG Kd_LSERMOUS_Mask;
162 ULONG Kd_KBDHID_Mask;
163 ULONG Kd_MOUHID_Mask;
164 ULONG Kd_KBDCLASS_Mask;
165 ULONG Kd_MOUCLASS_Mask;
166 ULONG Kd_TWOTRACK_Mask;
167 ULONG Kd_WMILIB_Mask;
168 ULONG Kd_ACPI_Mask;
169 ULONG Kd_AMLI_Mask;
170 ULONG Kd_HALIA64_Mask;
171 ULONG Kd_VIDEO_Mask;
172 ULONG Kd_SVCHOST_Mask;
173 ULONG Kd_VIDEOPRT_Mask;
174 ULONG Kd_TCPIP_Mask;
175 ULONG Kd_DMSYNTH_Mask;
176 ULONG Kd_NTOSPNP_Mask;
177 ULONG Kd_FASTFAT_Mask;
178 ULONG Kd_SAMSS_Mask;
179 ULONG Kd_PNPMGR_Mask;
180 ULONG Kd_NETAPI_Mask;
181 ULONG Kd_SCSERVER_Mask;
182 ULONG Kd_SCCLIENT_Mask;
183 ULONG Kd_SERIAL_Mask;
184 ULONG Kd_SERENUM_Mask;
185 ULONG Kd_UHCD_Mask;
186 ULONG Kd_RPCPROXY_Mask;
187 ULONG Kd_AUTOCHK_Mask;
188 ULONG Kd_DCOMSS_Mask;
189 ULONG Kd_UNIMODEM_Mask;
190 ULONG Kd_SIS_Mask;
191 ULONG Kd_FLTMGR_Mask;
192 ULONG Kd_WMICORE_Mask;
193 ULONG Kd_BURNENG_Mask;
194 ULONG Kd_IMAPI_Mask;
195 ULONG Kd_SXS_Mask;
196 ULONG Kd_FUSION_Mask;
197 ULONG Kd_IDLETASK_Mask;
198 ULONG Kd_SOFTPCI_Mask;
199 ULONG Kd_TAPE_Mask;
200 ULONG Kd_MCHGR_Mask;
201 ULONG Kd_IDEP_Mask;
202 ULONG Kd_PCIIDE_Mask;
203 ULONG Kd_FLOPPY_Mask;
204 ULONG Kd_FDC_Mask;
205 ULONG Kd_TERMSRV_Mask;
206 ULONG Kd_W32TIME_Mask;
207 ULONG Kd_PREFETCHER_Mask;
208 ULONG Kd_RSFILTER_Mask;
209 ULONG Kd_FCPORT_Mask;
210 ULONG Kd_PCI_Mask;
211 ULONG Kd_DMIO_Mask;
212 ULONG Kd_DMCONFIG_Mask;
213 ULONG Kd_DMADMIN_Mask;
214 ULONG Kd_WSOCKTRANSPORT_Mask;
215 ULONG Kd_VSS_Mask;
216 ULONG Kd_PNPMEM_Mask;
217 ULONG Kd_PROCESSOR_Mask;
218 ULONG Kd_DMSERVER_Mask;
219 ULONG Kd_SR_Mask;
220 ULONG Kd_INFINIBAND_Mask;
221 ULONG Kd_IHVDRIVER_Mask;
222 ULONG Kd_IHVVIDEO_Mask;
223 ULONG Kd_IHVAUDIO_Mask;
224 ULONG Kd_IHVNETWORK_Mask;
225 ULONG Kd_IHVSTREAMING_Mask;
226 ULONG Kd_IHVBUS_Mask;
227 ULONG Kd_HPS_Mask;
228 ULONG Kd_RTLTHREADPOOL_Mask;
229 ULONG Kd_LDR_Mask;
230 ULONG Kd_TCPIP6_Mask;
231 ULONG Kd_ISAPNP_Mask;
232 ULONG Kd_SHPC_Mask;
233 ULONG Kd_STORPORT_Mask;
234 ULONG Kd_STORMINIPORT_Mask;
235 ULONG Kd_PRINTSPOOLER_Mask;
236 ULONG Kd_VSSDYNDISK_Mask;
237 ULONG Kd_VERIFIER_Mask;
238 ULONG Kd_VDS_Mask;
239 ULONG Kd_VDSBAS_Mask;
240 ULONG Kd_VDSDYN_Mask;   // Specified in Vista+
241 ULONG Kd_VDSDYNDR_Mask;
242 ULONG Kd_VDSLDR_Mask;   // Specified in Vista+
243 ULONG Kd_VDSUTIL_Mask;
244 ULONG Kd_DFRGIFC_Mask;
245 ULONG Kd_DEFAULT_Mask;
246 ULONG Kd_MM_Mask;
247 ULONG Kd_DFSC_Mask;
248 ULONG Kd_WOW64_Mask;
249 //
250 // Components specified in Vista+, some of which we also use in ReactOS
251 //
252 ULONG Kd_ALPC_Mask;
253 ULONG Kd_WDI_Mask;
254 ULONG Kd_PERFLIB_Mask;
255 ULONG Kd_KTM_Mask;
256 ULONG Kd_IOSTRESS_Mask;
257 ULONG Kd_HEAP_Mask;
258 ULONG Kd_WHEA_Mask;
259 ULONG Kd_USERGDI_Mask;
260 ULONG Kd_MMCSS_Mask;
261 ULONG Kd_TPM_Mask;
262 ULONG Kd_THREADORDER_Mask;
263 ULONG Kd_ENVIRON_Mask;
264 ULONG Kd_EMS_Mask;
265 ULONG Kd_WDT_Mask;
266 ULONG Kd_FVEVOL_Mask;
267 ULONG Kd_NDIS_Mask;
268 ULONG Kd_NVCTRACE_Mask;
269 ULONG Kd_LUAFV_Mask;
270 ULONG Kd_APPCOMPAT_Mask;
271 ULONG Kd_USBSTOR_Mask;
272 ULONG Kd_SBP2PORT_Mask;
273 ULONG Kd_COVERAGE_Mask;
274 ULONG Kd_CACHEMGR_Mask;
275 ULONG Kd_MOUNTMGR_Mask;
276 ULONG Kd_CFR_Mask;
277 ULONG Kd_TXF_Mask;
278 ULONG Kd_KSECDD_Mask;
279 ULONG Kd_FLTREGRESS_Mask;
280 ULONG Kd_MPIO_Mask;
281 ULONG Kd_MSDSM_Mask;
282 ULONG Kd_UDFS_Mask;
283 ULONG Kd_PSHED_Mask;
284 ULONG Kd_STORVSP_Mask;
285 ULONG Kd_LSASS_Mask;
286 ULONG Kd_SSPICLI_Mask;
287 ULONG Kd_CNG_Mask;
288 ULONG Kd_EXFAT_Mask;
289 ULONG Kd_FILETRACE_Mask;
290 ULONG Kd_XSAVE_Mask;
291 ULONG Kd_SE_Mask;
292 ULONG Kd_DRIVEEXTENDER_Mask;
293 //
294 // Components specified in Windows 8
295 //
296 ULONG Kd_POWER_Mask;
297 ULONG Kd_CRASHDUMPXHCI_Mask;
298 ULONG Kd_GPIO_Mask;
299 ULONG Kd_REFS_Mask;
300 ULONG Kd_WER_Mask;
301 //
302 // Components specified in Windows 10
303 //
304 ULONG Kd_CAPIMG_Mask;
305 ULONG Kd_VPCI_Mask;
306 ULONG Kd_STORAGECLASSMEMORY_Mask;
307 ULONG Kd_FSLIB_Mask;
308 // End Mask
309 ULONG Kd_ENDOFTABLE_Mask;
310 
311 //
312 // Debug Filter Component Table
313 //
314 PULONG KdComponentTable[MAX_KD_COMPONENT_TABLE_ENTRIES] =
315 {
316     &Kd_SYSTEM_Mask,
317     &Kd_SMSS_Mask,
318     &Kd_SETUP_Mask,
319     &Kd_NTFS_Mask,
320     &Kd_FSTUB_Mask,
321     &Kd_CRASHDUMP_Mask,
322     &Kd_CDAUDIO_Mask,
323     &Kd_CDROM_Mask,
324     &Kd_CLASSPNP_Mask,
325     &Kd_DISK_Mask,
326     &Kd_REDBOOK_Mask,
327     &Kd_STORPROP_Mask,
328     &Kd_SCSIPORT_Mask,
329     &Kd_SCSIMINIPORT_Mask,
330     &Kd_CONFIG_Mask,
331     &Kd_I8042PRT_Mask,
332     &Kd_SERMOUSE_Mask,
333     &Kd_LSERMOUS_Mask,
334     &Kd_KBDHID_Mask,
335     &Kd_MOUHID_Mask,
336     &Kd_KBDCLASS_Mask,
337     &Kd_MOUCLASS_Mask,
338     &Kd_TWOTRACK_Mask,
339     &Kd_WMILIB_Mask,
340     &Kd_ACPI_Mask,
341     &Kd_AMLI_Mask,
342     &Kd_HALIA64_Mask,
343     &Kd_VIDEO_Mask,
344     &Kd_SVCHOST_Mask,
345     &Kd_VIDEOPRT_Mask,
346     &Kd_TCPIP_Mask,
347     &Kd_DMSYNTH_Mask,
348     &Kd_NTOSPNP_Mask,
349     &Kd_FASTFAT_Mask,
350     &Kd_SAMSS_Mask,
351     &Kd_PNPMGR_Mask,
352     &Kd_NETAPI_Mask,
353     &Kd_SCSERVER_Mask,
354     &Kd_SCCLIENT_Mask,
355     &Kd_SERIAL_Mask,
356     &Kd_SERENUM_Mask,
357     &Kd_UHCD_Mask,
358     &Kd_RPCPROXY_Mask,
359     &Kd_AUTOCHK_Mask,
360     &Kd_DCOMSS_Mask,
361     &Kd_UNIMODEM_Mask,
362     &Kd_SIS_Mask,
363     &Kd_FLTMGR_Mask,
364     &Kd_WMICORE_Mask,
365     &Kd_BURNENG_Mask,
366     &Kd_IMAPI_Mask,
367     &Kd_SXS_Mask,
368     &Kd_FUSION_Mask,
369     &Kd_IDLETASK_Mask,
370     &Kd_SOFTPCI_Mask,
371     &Kd_TAPE_Mask,
372     &Kd_MCHGR_Mask,
373     &Kd_IDEP_Mask,
374     &Kd_PCIIDE_Mask,
375     &Kd_FLOPPY_Mask,
376     &Kd_FDC_Mask,
377     &Kd_TERMSRV_Mask,
378     &Kd_W32TIME_Mask,
379     &Kd_PREFETCHER_Mask,
380     &Kd_RSFILTER_Mask,
381     &Kd_FCPORT_Mask,
382     &Kd_PCI_Mask,
383     &Kd_DMIO_Mask,
384     &Kd_DMCONFIG_Mask,
385     &Kd_DMADMIN_Mask,
386     &Kd_WSOCKTRANSPORT_Mask,
387     &Kd_VSS_Mask,
388     &Kd_PNPMEM_Mask,
389     &Kd_PROCESSOR_Mask,
390     &Kd_DMSERVER_Mask,
391     &Kd_SR_Mask,
392     &Kd_INFINIBAND_Mask,
393     &Kd_IHVDRIVER_Mask,
394     &Kd_IHVVIDEO_Mask,
395     &Kd_IHVAUDIO_Mask,
396     &Kd_IHVNETWORK_Mask,
397     &Kd_IHVSTREAMING_Mask,
398     &Kd_IHVBUS_Mask,
399     &Kd_HPS_Mask,
400     &Kd_RTLTHREADPOOL_Mask,
401     &Kd_LDR_Mask,
402     &Kd_TCPIP6_Mask,
403     &Kd_ISAPNP_Mask,
404     &Kd_SHPC_Mask,
405     &Kd_STORPORT_Mask,
406     &Kd_STORMINIPORT_Mask,
407     &Kd_PRINTSPOOLER_Mask,
408     &Kd_VSSDYNDISK_Mask,
409     &Kd_VERIFIER_Mask,
410     &Kd_VDS_Mask,
411     &Kd_VDSBAS_Mask,
412     &Kd_VDSDYN_Mask,    // Specified in Vista+
413     &Kd_VDSDYNDR_Mask,
414     &Kd_VDSLDR_Mask,    // Specified in Vista+
415     &Kd_VDSUTIL_Mask,
416     &Kd_DFRGIFC_Mask,
417     &Kd_DEFAULT_Mask,
418     &Kd_MM_Mask,
419     &Kd_DFSC_Mask,
420     &Kd_WOW64_Mask,
421 //
422 // Components specified in Vista+, some of which we also use in ReactOS
423 //
424     &Kd_ALPC_Mask,
425     &Kd_WDI_Mask,
426     &Kd_PERFLIB_Mask,
427     &Kd_KTM_Mask,
428     &Kd_IOSTRESS_Mask,
429     &Kd_HEAP_Mask,
430     &Kd_WHEA_Mask,
431     &Kd_USERGDI_Mask,
432     &Kd_MMCSS_Mask,
433     &Kd_TPM_Mask,
434     &Kd_THREADORDER_Mask,
435     &Kd_ENVIRON_Mask,
436     &Kd_EMS_Mask,
437     &Kd_WDT_Mask,
438     &Kd_FVEVOL_Mask,
439     &Kd_NDIS_Mask,
440     &Kd_NVCTRACE_Mask,
441     &Kd_LUAFV_Mask,
442     &Kd_APPCOMPAT_Mask,
443     &Kd_USBSTOR_Mask,
444     &Kd_SBP2PORT_Mask,
445     &Kd_COVERAGE_Mask,
446     &Kd_CACHEMGR_Mask,
447     &Kd_MOUNTMGR_Mask,
448     &Kd_CFR_Mask,
449     &Kd_TXF_Mask,
450     &Kd_KSECDD_Mask,
451     &Kd_FLTREGRESS_Mask,
452     &Kd_MPIO_Mask,
453     &Kd_MSDSM_Mask,
454     &Kd_UDFS_Mask,
455     &Kd_PSHED_Mask,
456     &Kd_STORVSP_Mask,
457     &Kd_LSASS_Mask,
458     &Kd_SSPICLI_Mask,
459     &Kd_CNG_Mask,
460     &Kd_EXFAT_Mask,
461     &Kd_FILETRACE_Mask,
462     &Kd_XSAVE_Mask,
463     &Kd_SE_Mask,
464     &Kd_DRIVEEXTENDER_Mask,
465 //
466 // Components specified in Windows 8
467 //
468     &Kd_POWER_Mask,
469     &Kd_CRASHDUMPXHCI_Mask,
470     &Kd_GPIO_Mask,
471     &Kd_REFS_Mask,
472     &Kd_WER_Mask,
473 //
474 // Components specified in Windows 10
475 //
476     &Kd_CAPIMG_Mask,
477     &Kd_VPCI_Mask,
478     &Kd_STORAGECLASSMEMORY_Mask,
479     &Kd_FSLIB_Mask,
480 // End Mask
481     &Kd_ENDOFTABLE_Mask,
482 };
483 
484 ULONG KdComponentTableSize = RTL_NUMBER_OF(KdComponentTable);
485 
486 //
487 // Debugger Data
488 //
489 LIST_ENTRY KdpDebuggerDataListHead;
490 KSPIN_LOCK KdpDataSpinLock;
491 
492 //
493 // Debugger Version and Data Block
494 //
495 DBGKD_GET_VERSION64 KdVersionBlock =
496 {
497     0,
498     0,
499     DBGKD_64BIT_PROTOCOL_VERSION2,
500     CURRENT_KD_SECONDARY_VERSION,
501 #if defined(_M_AMD64) || defined(_M_ARM64)
502     DBGKD_VERS_FLAG_DATA | DBGKD_VERS_FLAG_PTR64,
503 #else
504     DBGKD_VERS_FLAG_DATA,
505 #endif
506     IMAGE_FILE_MACHINE_NATIVE,
507     PACKET_TYPE_MAX,
508     0,
509     0,
510     DBGKD_SIMULATION_NONE,
511     {0},
512     0,
513     0,
514     0
515 };
516 
517 #if (NTDDI_VERSION >= NTDDI_WS03)
518 C_ASSERT(sizeof(KDDEBUGGER_DATA64) >= 0x318);
519 #endif
520 
521 #if !defined(_WIN64) && (defined(__GNUC__) || defined(__clang__))
522 /* Minimal hackery for GCC/Clang, see commit b9cd3f2d9 (r25845) and de81021ba */
523 #define PtrToUL64(x)    ((ULPTR64)(ULONG_PTR)(x))
524 #else
525 #define PtrToUL64(x)    ((ULPTR64)(x))
526 #endif
527 KDDEBUGGER_DATA64 KdDebuggerDataBlock =
528 {
529     {{0}},
530     0,
531     PtrToUL64(RtlpBreakWithStatusInstruction),
532     0,
533     FIELD_OFFSET(KTHREAD, CallbackStack),
534 #if defined(_M_ARM) || defined(_M_AMD64)
535     0,
536     0,
537 #else
538     FIELD_OFFSET(KCALLOUT_FRAME, CallbackStack),
539     FIELD_OFFSET(KCALLOUT_FRAME, CBSTACK_FRAME_POINTER),
540 #endif
541     FALSE,
542     PtrToUL64(KiCallUserMode),
543     0,
544     PtrToUL64(&PsLoadedModuleList),
545     PtrToUL64(&PsActiveProcessHead),
546     PtrToUL64(&PspCidTable),
547     PtrToUL64(&ExpSystemResourcesList),
548     PtrToUL64(ExpPagedPoolDescriptor),
549     PtrToUL64(&ExpNumberOfPagedPools),
550     PtrToUL64(&KeTimeIncrement),
551     PtrToUL64(&KeBugcheckCallbackListHead),
552     PtrToUL64(KiBugCheckData),
553     PtrToUL64(&IopErrorLogListHead),
554     PtrToUL64(&ObpRootDirectoryObject),
555     PtrToUL64(&ObpTypeObjectType),
556     PtrToUL64(&MmSystemCacheStart),
557     PtrToUL64(&MmSystemCacheEnd),
558     PtrToUL64(&MmSystemCacheWs),
559     PtrToUL64(&MmPfnDatabase),
560     PtrToUL64(MmSystemPtesStart),
561     PtrToUL64(MmSystemPtesEnd),
562     PtrToUL64(&MmSubsectionBase),
563     PtrToUL64(&MmNumberOfPagingFiles),
564     PtrToUL64(&MmLowestPhysicalPage),
565     PtrToUL64(&MmHighestPhysicalPage),
566     PtrToUL64(&MmNumberOfPhysicalPages),
567     PtrToUL64(&MmMaximumNonPagedPoolInBytes),
568     PtrToUL64(&MmNonPagedSystemStart),
569     PtrToUL64(&MmNonPagedPoolStart),
570     PtrToUL64(&MmNonPagedPoolEnd),
571     PtrToUL64(&MmPagedPoolStart),
572     PtrToUL64(&MmPagedPoolEnd),
573     PtrToUL64(&MmPagedPoolInfo),
574     PAGE_SIZE,
575     PtrToUL64(&MmSizeOfPagedPoolInBytes),
576     PtrToUL64(&MmTotalCommitLimit),
577     PtrToUL64(&MmTotalCommittedPages),
578     PtrToUL64(&MmSharedCommit),
579     PtrToUL64(&MmDriverCommit),
580     PtrToUL64(&MmProcessCommit),
581     PtrToUL64(&MmPagedPoolCommit),
582     PtrToUL64(0),
583     PtrToUL64(&MmZeroedPageListHead),
584     PtrToUL64(&MmFreePageListHead),
585     PtrToUL64(&MmStandbyPageListHead),
586     PtrToUL64(&MmModifiedPageListHead),
587     PtrToUL64(&MmModifiedNoWritePageListHead),
588     PtrToUL64(&MmAvailablePages),
589     PtrToUL64(&MmResidentAvailablePages),
590     PtrToUL64(&PoolTrackTable),
591     PtrToUL64(&NonPagedPoolDescriptor),
592     PtrToUL64(&MmHighestUserAddress),
593     PtrToUL64(&MmSystemRangeStart),
594     PtrToUL64(&MmUserProbeAddress),
595     PtrToUL64(KdPrintDefaultCircularBuffer),
596     PtrToUL64(KdPrintDefaultCircularBuffer + sizeof(KdPrintDefaultCircularBuffer)),
597     PtrToUL64(&KdPrintWritePointer),
598     PtrToUL64(&KdPrintRolloverCount),
599     PtrToUL64(&MmLoadedUserImageList),
600     PtrToUL64(&NtBuildLab),
601     PtrToUL64(0),
602     PtrToUL64(KiProcessorBlock),
603     PtrToUL64(&MmUnloadedDrivers),
604     PtrToUL64(&MmLastUnloadedDrivers),
605     PtrToUL64(&MmTriageActionTaken),
606     PtrToUL64(&MmSpecialPoolTag),
607     PtrToUL64(&KernelVerifier),
608     PtrToUL64(&MmVerifierData),
609     PtrToUL64(&MmAllocatedNonPagedPool),
610     PtrToUL64(&MmPeakCommitment),
611     PtrToUL64(&MmtotalCommitLimitMaximum),
612     PtrToUL64(&CmNtCSDVersion),
613     PtrToUL64(&MmPhysicalMemoryBlock),
614     PtrToUL64(&MmSessionBase),
615     PtrToUL64(&MmSessionSize),
616     PtrToUL64(0),
617     PtrToUL64(0),
618     FIELD_OFFSET(KTHREAD, NextProcessor),
619     FIELD_OFFSET(KTHREAD, Teb),
620     FIELD_OFFSET(KTHREAD, KernelStack),
621     FIELD_OFFSET(KTHREAD, InitialStack),
622     FIELD_OFFSET(KTHREAD, ApcState.Process),
623     FIELD_OFFSET(KTHREAD, State),
624     0,
625     0,
626     sizeof(EPROCESS),
627     FIELD_OFFSET(EPROCESS, Peb),
628     FIELD_OFFSET(EPROCESS, InheritedFromUniqueProcessId),
629     FIELD_OFFSET(EPROCESS, Pcb.DirectoryTableBase),
630     sizeof(KPRCB),
631     FIELD_OFFSET(KPRCB, DpcRoutineActive),
632     FIELD_OFFSET(KPRCB, CurrentThread),
633     FIELD_OFFSET(KPRCB, MHz),
634     FIELD_OFFSET(KPRCB, CpuType),
635     FIELD_OFFSET(KPRCB, VendorString),
636     FIELD_OFFSET(KPRCB, ProcessorState.ContextFrame),
637     FIELD_OFFSET(KPRCB, Number),
638     sizeof(ETHREAD),
639     PtrToUL64(&KdPrintCircularBuffer),
640     PtrToUL64(&KdPrintBufferSize),
641     PtrToUL64(&KeLoaderBlock),
642     sizeof(KPCR),
643     KPCR_SELF_PCR_OFFSET,
644     KPCR_CURRENT_PRCB_OFFSET,
645     KPCR_CONTAINED_PRCB_OFFSET,
646     0,
647     0,
648 #if defined(_M_ARM)
649     _WARN("KPCR_INITIAL_STACK_OFFSET, KPCR_STACK_LIMIT_OFFSET and KPRCB_PCR_PAGE_OFFSET not properly defined on ARM")
650     0,
651     0,
652     0,
653 #else
654     KPCR_INITIAL_STACK_OFFSET,
655     KPCR_STACK_LIMIT_OFFSET,
656     KPRCB_PCR_PAGE_OFFSET,
657 #endif
658     FIELD_OFFSET(KPRCB, ProcessorState.SpecialRegisters),
659 #if defined(_M_IX86)
660     //
661     // x86 GDT/LDT/TSS constants
662     //
663     KGDT_R0_CODE,
664     KGDT_R0_DATA,
665     KGDT_R0_PCR,
666     KGDT_R3_CODE,
667     KGDT_R3_DATA,
668     KGDT_R3_TEB,
669     KGDT_LDT,
670     KGDT_TSS,
671     0,
672     0,
673 #elif defined(_M_AMD64)
674     //
675     // AMD64 GDT/LDT/TSS constants
676     //
677     KGDT64_R0_CODE,
678     KGDT64_R3_DATA,
679     KGDT64_R3_DATA,
680     KGDT64_R3_CODE,
681     KGDT64_R3_DATA,
682     KGDT64_R3_DATA,
683     0,
684     KGDT64_SYS_TSS,
685     0,
686     0,
687 #else
688     //
689     // No GDT/LDT/TSS on other architectures
690     //
691     0,
692     0,
693     0,
694     0,
695     0,
696     0,
697     0,
698     0,
699     0,
700     0,
701 #endif
702     PtrToUL64(&IopNumTriageDumpDataBlocks),
703     PtrToUL64(IopTriageDumpDataBlocks),
704 
705 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
706 #error KdDebuggerDataBlock requires other fields for this NT version!
707 #endif
708 };
709