ReactOS  0.4.15-dev-2985-g54406bf
kd.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <cportlib/cportlib.h>
4 
5 //
6 // Kernel Debugger Port Definition
7 //
8 struct _KD_DISPATCH_TABLE;
9 
10 BOOLEAN
11 NTAPI
14  ULONG ComPortNumber
15 );
16 
17 BOOLEAN
18 NTAPI
21  PUCHAR ByteReceived);
22 
23 VOID
24 NTAPI
27  UCHAR ByteToSend
28 );
29 
30 /* SYMBOL ROUTINES **********************************************************/
31 #ifdef __NTOSKRNL__
32 
33 #ifdef KDBG
34 # define KdbInit() KdbpCliInit()
35 # define KdbModuleLoaded(FILENAME) KdbpCliModuleLoaded(FILENAME)
36 #else
37 # define KdbInit() do { } while (0)
38 # define KdbEnter() do { } while (0)
39 # define KdbModuleLoaded(X) do { } while (0)
40 #endif
41 
42 /* KD ROUTINES ***************************************************************/
43 
44 typedef enum _KD_CONTINUE_TYPE
45 {
46  kdContinue = 0,
47  kdDoNotHandleException,
48  kdHandleException
49 } KD_CONTINUE_TYPE;
50 
51 typedef
52 VOID
53 (NTAPI*PKDP_INIT_ROUTINE)(
54  struct _KD_DISPATCH_TABLE *DispatchTable,
55  ULONG BootPhase
56 );
57 
58 typedef
59 VOID
60 (NTAPI*PKDP_PRINT_ROUTINE)(
61  PCHAR String,
63 );
64 
65 /* INIT ROUTINES *************************************************************/
66 
67 BOOLEAN
68 NTAPI
71  PLOADER_PARAMETER_BLOCK LoaderBlock
72 );
73 
74 VOID
76 
77 VOID
79 
80 VOID
81 NTAPI
83  struct _KD_DISPATCH_TABLE *DispatchTable,
84  ULONG BootPhase
85 );
86 
87 VOID
88 NTAPI
90  struct _KD_DISPATCH_TABLE *DispatchTable,
91  ULONG BootPhase
92 );
93 
94 VOID
95 NTAPI
97  struct _KD_DISPATCH_TABLE *DispatchTable,
98  ULONG BootPhase
99 );
100 
101 VOID
102 NTAPI
104  struct _KD_DISPATCH_TABLE *DispatchTable,
105  ULONG BootPhase);
106 
107 
108 /* KD ROUTINES ***************************************************************/
109 
110 BOOLEAN
111 NTAPI
112 KdpDetectConflicts(PCM_RESOURCE_LIST DriverList);
113 
114 BOOLEAN
115 NTAPI
117  IN ULONG_PTR Addr,
118  IN LONG Len,
119  OUT PVOID Value
120 );
121 
122 BOOLEAN
123 NTAPI
125  IN ULONG_PTR Addr,
126  IN LONG Len,
128 );
129 
130 
131 /* KD GLOBALS ***************************************************************/
132 
133 /* Serial debug connection */
134 #define DEFAULT_DEBUG_PORT 2 /* COM2 */
135 #define DEFAULT_DEBUG_COM1_IRQ 4 /* COM1 IRQ */
136 #define DEFAULT_DEBUG_COM2_IRQ 3 /* COM2 IRQ */
137 #define DEFAULT_DEBUG_BAUD_RATE 115200 /* 115200 Baud */
138 
139 /* KD Native Modes */
140 #define KdScreen 0
141 #define KdSerial 1
142 #define KdFile 2
143 #define KdKdbg 3
144 #define KdMax 4
145 
146 /* KD Private Debug Modes */
147 typedef struct _KDP_DEBUG_MODE
148 {
149  union
150  {
151  struct
152  {
153  /* Native Modes */
154  UCHAR Screen :1;
155  UCHAR Serial :1;
156  UCHAR File :1;
157  };
158 
159  /* Generic Value */
160  ULONG Value;
161  };
162 } KDP_DEBUG_MODE;
163 
164 /* KD Internal Debug Services */
165 typedef enum _KDP_DEBUG_SERVICE
166 {
167  DumpNonPagedPool = 0x1e, /* a */
168  ManualBugCheck = 0x30, /* b */
169  DumpNonPagedPoolStats = 0x2e, /* c */
170  DumpNewNonPagedPool = 0x20, /* d */
171  DumpNewNonPagedPoolStats = 0x12, /* e */
172  DumpAllThreads = 0x21, /* f */
173  DumpUserThreads = 0x22, /* g */
174  KdSpare1 = 0x23, /* h */
175  KdSpare2 = 0x17, /* i */
176  KdSpare3 = 0x24, /* j */
177  EnterDebugger = 0x25, /* k */
178  ThatsWhatSheSaid = 69 /* FIGURE IT OUT */
179 } KDP_DEBUG_SERVICE;
180 
181 /* Dispatch Table for Wrapper Functions */
182 typedef struct _KD_DISPATCH_TABLE
183 {
184  LIST_ENTRY KdProvidersList;
185  PKDP_INIT_ROUTINE KdpInitRoutine;
186  PKDP_PRINT_ROUTINE KdpPrintRoutine;
187 } KD_DISPATCH_TABLE, *PKD_DISPATCH_TABLE;
188 
189 /* The current Debugging Mode */
190 extern KDP_DEBUG_MODE KdpDebugMode;
191 
192 /* Port Information for the Serial Native Mode */
193 extern ULONG SerialPortNumber;
194 extern CPPORT SerialPortInfo;
195 
196 /* Init Functions for Native Providers */
197 extern PKDP_INIT_ROUTINE InitRoutines[KdMax];
198 
199 /* Dispatch Tables for Native Providers */
200 extern KD_DISPATCH_TABLE DispatchTable[KdMax];
201 
202 /* The KD Native Provider List */
203 extern LIST_ENTRY KdProviders;
204 
205 #endif
206 
207 #if DBG && defined(_M_IX86) && !defined(_WINKD_) // See ke/i386/traphdlr.c
208 #define ID_Win32PreServiceHook 'WSH0'
209 #define ID_Win32PostServiceHook 'WSH1'
210 typedef void (NTAPI *PKDBG_PRESERVICEHOOK)(ULONG, PULONG_PTR);
211 typedef ULONG_PTR (NTAPI *PKDBG_POSTSERVICEHOOK)(ULONG, ULONG_PTR);
212 extern PKDBG_PRESERVICEHOOK KeWin32PreServiceHook;
213 extern PKDBG_POSTSERVICEHOOK KeWin32PostServiceHook;
214 #endif
signed char * PCHAR
Definition: retypes.h:7
#define IN
Definition: typedefs.h:39
VOID NTAPI KdpKdbgInit(PKD_DISPATCH_TABLE DispatchTable, ULONG BootPhase)
Definition: kdbg.c:21
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
unsigned char * PUCHAR
Definition: retypes.h:3
IN CINT OUT PVOID PortInformation
Definition: dumpinfo.c:39
VOID NTAPI KdpSerialInit(PKD_DISPATCH_TABLE DispatchTable, ULONG BootPhase)
Definition: kdio.c:334
uint32_t ULONG_PTR
Definition: typedefs.h:65
KDP_DEBUG_MODE KdpDebugMode
Definition: kdio.c:48
BOOLEAN NTAPI KdPortInitializeEx(PCPPORT PortInformation, ULONG ComPortNumber)
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2430
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
VOID NTAPI KdpScreenInit(PKD_DISPATCH_TABLE DispatchTable, ULONG BootPhase)
Definition: kdio.c:500
long LONG
Definition: pedump.c:60
VOID KdpScreenRelease(VOID)
Definition: kdio.c:387
unsigned char BOOLEAN
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
VOID NTAPI KdPortPutByteEx(PCPPORT PortInformation, UCHAR ByteToSend)
BOOLEAN NTAPI KdpSafeReadMemory(ULONG_PTR Addr, LONG Len, PVOID Value)
Definition: kdmemsup.c:165
VOID KdpScreenAcquire(VOID)
Definition: kdio.c:368
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:406
uint64_t ULONGLONG
Definition: typedefs.h:67
#define Len
Definition: deflate.h:82
unsigned char UCHAR
Definition: xmlstorage.h:181
BOOLEAN NTAPI KdPortGetByteEx(PCPPORT PortInformation, PUCHAR ByteReceived)
BOOLEAN NTAPI KdpSafeWriteMemory(ULONG_PTR Addr, LONG Len, ULONGLONG Value)
Definition: kdmemsup.c:201
#define VOID
Definition: acefi.h:82
Definition: typedefs.h:119
BOOLEAN NTAPI KdInitSystem(ULONG Reserved, PLOADER_PARAMETER_BLOCK LoaderBlock)
PKDP_INIT_ROUTINE InitRoutines[KdMax]
Definition: kdio.c:52
CPPORT SerialPortInfo
Definition: kdio.c:34
ULONG SerialPortNumber
Definition: kdio.c:33
#define OUT
Definition: typedefs.h:40
unsigned int ULONG
Definition: retypes.h:1
#define ULONG_PTR
Definition: config.h:101
uint32_t * PULONG_PTR
Definition: typedefs.h:65
Definition: console.h:34
VOID NTAPI KdpDebugLogInit(PKD_DISPATCH_TABLE DispatchTable, ULONG BootPhase)
Definition: kdio.c:211
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID _In_ LONG _In_z_ PCHAR File
Definition: wdfdevice.h:4061
_In_ PWDFDEVICE_INIT _In_ PWDF_PDO_EVENT_CALLBACKS DispatchTable
Definition: wdfpdo.h:245
LIST_ENTRY KdProviders
Definition: kdio.c:49