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