1 /****************************************************************************** 2 * Kernel Debugger Types * 3 ******************************************************************************/ 4 $if (_NTDDK_) 5 typedef struct _DEBUG_DEVICE_ADDRESS { 6 UCHAR Type; 7 BOOLEAN Valid; 8 #if (NTDDI_VERSION >= NTDDI_WIN10_RS3) 9 union { 10 #endif 11 UCHAR Reserved[2]; 12 #if (NTDDI_VERSION >= NTDDI_WIN10_RS3) 13 struct { 14 UCHAR BitWidth; 15 UCHAR AccessSize; 16 }; 17 }; 18 #endif 19 PUCHAR TranslatedAddress; 20 ULONG Length; 21 } DEBUG_DEVICE_ADDRESS, *PDEBUG_DEVICE_ADDRESS; 22 23 typedef struct _DEBUG_MEMORY_REQUIREMENTS { 24 PHYSICAL_ADDRESS Start; 25 PHYSICAL_ADDRESS MaxEnd; 26 PVOID VirtualAddress; 27 ULONG Length; 28 BOOLEAN Cached; 29 BOOLEAN Aligned; 30 } DEBUG_MEMORY_REQUIREMENTS, *PDEBUG_MEMORY_REQUIREMENTS; 31 32 #if (NTDDI_VERSION >= NTDDI_WIN8) 33 typedef enum { 34 KdNameSpacePCI, 35 KdNameSpaceACPI, 36 KdNameSpaceAny, 37 KdNameSpaceNone, 38 KdNameSpaceMax, /* Maximum namespace enumerator */ 39 } KD_NAMESPACE_ENUM, *PKD_NAMESPACE_ENUM; 40 #endif 41 42 #if (NTDDI_VERSION >= NTDDI_WIN10) 43 typedef struct _DEBUG_TRANSPORT_DATA { 44 ULONG HwContextSize; 45 BOOLEAN UseSerialFraming; 46 #if (NTDDI_VERSION >= NTDDI_WIN10_RS5) 47 BOOLEAN ValidUSBCoreId; 48 UCHAR USBCoreId; 49 #endif 50 } DEBUG_TRANSPORT_DATA, *PDEBUG_TRANSPORT_DATA; 51 #endif 52 53 #define MAXIMUM_DEBUG_BARS 6 54 55 #if (NTDDI_VERSION >= NTDDI_WIN10) 56 #define DBG_DEVICE_FLAG_HAL_SCRATCH_ALLOCATED 0x01 57 #define DBG_DEVICE_FLAG_BARS_MAPPED 0x02 58 #define DBG_DEVICE_FLAG_SCRATCH_ALLOCATED 0x04 59 #endif 60 #if (NTDDI_VERSION >= NTDDI_WIN10_RS2) 61 #define DBG_DEVICE_FLAG_UNCACHED_MEMORY 0x08 62 #endif 63 #if (NTDDI_VERSION >= NTDDI_WIN10_RS3) 64 #define DBG_DEVICE_FLAG_SYNTHETIC 0x10 65 #endif 66 67 typedef struct _DEBUG_DEVICE_DESCRIPTOR { 68 ULONG Bus; 69 #if (NTDDI_VERSION >= NTDDI_VISTA) && (NTDDI_VERSION < NTDDI_WIN8) 70 USHORT Segment; 71 #endif 72 ULONG Slot; 73 #if (NTDDI_VERSION >= NTDDI_WIN8) 74 USHORT Segment; 75 #endif 76 USHORT VendorID; 77 USHORT DeviceID; 78 UCHAR BaseClass; 79 UCHAR SubClass; 80 UCHAR ProgIf; 81 #if (NTDDI_VERSION >= NTDDI_WIN8) 82 #if (NTDDI_VERSION >= NTDDI_WIN10) 83 union { 84 #endif 85 UCHAR Flags; 86 #if (NTDDI_VERSION >= NTDDI_WIN10) 87 struct { 88 UCHAR DbgHalScratchAllocated : 1; 89 UCHAR DbgBarsMapped : 1; 90 UCHAR DbgScratchAllocated : 1; 91 }; 92 }; 93 #endif 94 #endif 95 BOOLEAN Initialized; 96 #if (NTDDI_VERSION >= NTDDI_VISTA) 97 BOOLEAN Configured; 98 #endif 99 DEBUG_DEVICE_ADDRESS BaseAddress[MAXIMUM_DEBUG_BARS]; 100 DEBUG_MEMORY_REQUIREMENTS Memory; 101 #if (NTDDI_VERSION >= NTDDI_WIN10_19H1) 102 ULONG Dbg2TableIndex; 103 #endif 104 #if (NTDDI_VERSION >= NTDDI_WIN8) 105 USHORT PortType; 106 USHORT PortSubtype; 107 PVOID OemData; 108 ULONG OemDataLength; 109 KD_NAMESPACE_ENUM NameSpace; 110 PWCHAR NameSpacePath; 111 ULONG NameSpacePathLength; 112 #endif 113 #if (NTDDI_VERSION >= NTDDI_WIN10) 114 ULONG TransportType; 115 DEBUG_TRANSPORT_DATA TransportData; 116 #endif 117 } DEBUG_DEVICE_DESCRIPTOR, *PDEBUG_DEVICE_DESCRIPTOR; 118 119 typedef NTSTATUS 120 (NTAPI *pKdSetupPciDeviceForDebugging)( 121 _In_opt_ PVOID LoaderBlock, 122 _Inout_ PDEBUG_DEVICE_DESCRIPTOR PciDevice); 123 124 typedef NTSTATUS 125 (NTAPI *pKdReleasePciDeviceForDebugging)( 126 _Inout_ PDEBUG_DEVICE_DESCRIPTOR PciDevice); 127 128 typedef PVOID 129 (NTAPI *pKdGetAcpiTablePhase0)( 130 _In_ struct _LOADER_PARAMETER_BLOCK *LoaderBlock, 131 _In_ ULONG Signature); 132 133 typedef VOID 134 (NTAPI *pKdCheckPowerButton)(VOID); 135 136 #if (NTDDI_VERSION >= NTDDI_VISTA) 137 typedef PVOID 138 (NTAPI *pKdMapPhysicalMemory64)( 139 _In_ PHYSICAL_ADDRESS PhysicalAddress, 140 _In_ ULONG NumberPages, 141 _In_ BOOLEAN FlushCurrentTLB); 142 143 typedef VOID 144 (NTAPI *pKdUnmapVirtualAddress)( 145 _In_ PVOID VirtualAddress, 146 _In_ ULONG NumberPages, 147 _In_ BOOLEAN FlushCurrentTLB); 148 #else 149 typedef PVOID 150 (NTAPI *pKdMapPhysicalMemory64)( 151 _In_ PHYSICAL_ADDRESS PhysicalAddress, 152 _In_ ULONG NumberPages); 153 154 typedef VOID 155 (NTAPI *pKdUnmapVirtualAddress)( 156 _In_ PVOID VirtualAddress, 157 _In_ ULONG NumberPages); 158 #endif 159 160 typedef ULONG 161 (NTAPI *pKdGetPciDataByOffset)( 162 _In_ ULONG BusNumber, 163 _In_ ULONG SlotNumber, 164 _Out_writes_bytes_(Length) PVOID Buffer, 165 _In_ ULONG Offset, 166 _In_ ULONG Length); 167 168 typedef ULONG 169 (NTAPI *pKdSetPciDataByOffset)( 170 _In_ ULONG BusNumber, 171 _In_ ULONG SlotNumber, 172 _In_reads_bytes_(Length) PVOID Buffer, 173 _In_ ULONG Offset, 174 _In_ ULONG Length); 175 $endif (_NTDDK_) 176