ReactOS  0.4.15-dev-4874-g57c84dd
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 
32 #ifdef _NTOSKRNL_
33 
34 #ifdef KDBG
35 # define KdbInit() KdbpCliInit()
36 # define KdbModuleLoaded(FILENAME) KdbpCliModuleLoaded(FILENAME)
37 #else
38 # define KdbInit() do { } while (0)
39 # define KdbEnter() do { } while (0)
40 # define KdbModuleLoaded(X) do { } while (0)
41 #endif
42 
43 /* KD ROUTINES ***************************************************************/
44 
45 typedef enum _KD_CONTINUE_TYPE
46 {
47  kdContinue = 0,
48  kdDoNotHandleException,
49  kdHandleException
50 } KD_CONTINUE_TYPE;
51 
52 typedef
53 VOID
54 (NTAPI*PKDP_INIT_ROUTINE)(
55  struct _KD_DISPATCH_TABLE *DispatchTable,
56  ULONG BootPhase
57 );
58 
59 typedef
60 VOID
61 (NTAPI*PKDP_PRINT_ROUTINE)(
62  PCHAR String,
64 );
65 
66 /* INIT ROUTINES *************************************************************/
67 
68 BOOLEAN
69 NTAPI
72  PLOADER_PARAMETER_BLOCK LoaderBlock
73 );
74 
75 VOID
77 
78 VOID
80 
81 VOID
82 NTAPI
84  struct _KD_DISPATCH_TABLE *DispatchTable,
85  ULONG BootPhase
86 );
87 
88 VOID
89 NTAPI
91  struct _KD_DISPATCH_TABLE *DispatchTable,
92  ULONG BootPhase
93 );
94 
95 VOID
96 NTAPI
98  struct _KD_DISPATCH_TABLE *DispatchTable,
99  ULONG BootPhase
100 );
101 
102 VOID
103 NTAPI
105  struct _KD_DISPATCH_TABLE *DispatchTable,
106  ULONG BootPhase);
107 
108 
109 /* KD ROUTINES ***************************************************************/
110 
111 BOOLEAN
112 NTAPI
113 KdpDetectConflicts(PCM_RESOURCE_LIST DriverList);
114 
115 BOOLEAN
116 NTAPI
118  IN ULONG_PTR Addr,
119  IN LONG Len,
120  OUT PVOID Value
121 );
122 
123 BOOLEAN
124 NTAPI
126  IN ULONG_PTR Addr,
127  IN LONG Len,
129 );
130 
131 
132 /* KD GLOBALS ***************************************************************/
133 
134 /* Serial debug connection */
135 #define DEFAULT_DEBUG_PORT 2 /* COM2 */
136 #define DEFAULT_DEBUG_COM1_IRQ 4 /* COM1 IRQ */
137 #define DEFAULT_DEBUG_COM2_IRQ 3 /* COM2 IRQ */
138 #define DEFAULT_DEBUG_BAUD_RATE 115200 /* 115200 Baud */
139 
140 /* KD Native Modes */
141 #define KdScreen 0
142 #define KdSerial 1
143 #define KdFile 2
144 #define KdKdbg 3
145 #define KdMax 4
146 
147 /* KD Private Debug Modes */
148 typedef struct _KDP_DEBUG_MODE
149 {
150  union
151  {
152  struct
153  {
154  /* Native Modes */
155  UCHAR Screen :1;
156  UCHAR Serial :1;
157  UCHAR File :1;
158  };
159 
160  /* Generic Value */
161  ULONG Value;
162  };
163 } KDP_DEBUG_MODE;
164 
165 /* KD Internal Debug Services */
166 typedef enum _KDP_DEBUG_SERVICE
167 {
168  DumpNonPagedPool = 0x1e, /* a */
169  ManualBugCheck = 0x30, /* b */
170  DumpNonPagedPoolStats = 0x2e, /* c */
171  DumpNewNonPagedPool = 0x20, /* d */
172  DumpNewNonPagedPoolStats = 0x12, /* e */
173  DumpAllThreads = 0x21, /* f */
174  DumpUserThreads = 0x22, /* g */
175  KdSpare1 = 0x23, /* h */
176  KdSpare2 = 0x17, /* i */
177  KdSpare3 = 0x24, /* j */
178  EnterDebugger = 0x25, /* k */
179  ThatsWhatSheSaid = 69 /* FIGURE IT OUT */
180 } KDP_DEBUG_SERVICE;
181 
182 /* Dispatch Table for Wrapper Functions */
183 typedef struct _KD_DISPATCH_TABLE
184 {
185  LIST_ENTRY KdProvidersList;
186  PKDP_INIT_ROUTINE KdpInitRoutine;
187  PKDP_PRINT_ROUTINE KdpPrintRoutine;
188 } KD_DISPATCH_TABLE, *PKD_DISPATCH_TABLE;
189 
190 /* The current Debugging Mode */
191 extern KDP_DEBUG_MODE KdpDebugMode;
192 
193 /* Port Information for the Serial Native Mode */
194 extern ULONG SerialPortNumber;
195 extern CPPORT SerialPortInfo;
196 
197 /* Init Functions for Native Providers */
198 extern PKDP_INIT_ROUTINE InitRoutines[KdMax];
199 
200 /* Dispatch Tables for Native Providers */
201 extern KD_DISPATCH_TABLE DispatchTable[KdMax];
202 
203 /* The KD Native Provider List */
204 extern LIST_ENTRY KdProviders;
205 
206 #endif
207 
208 #if DBG && defined(_M_IX86) && !defined(_WINKD_) // See ke/i386/traphdlr.c
209 #define ID_Win32PreServiceHook 'WSH0'
210 #define ID_Win32PostServiceHook 'WSH1'
211 typedef void (NTAPI *PKDBG_PRESERVICEHOOK)(ULONG, PULONG_PTR);
212 typedef ULONG_PTR (NTAPI *PKDBG_POSTSERVICEHOOK)(ULONG, ULONG_PTR);
213 extern PKDBG_PRESERVICEHOOK KeWin32PreServiceHook;
214 extern PKDBG_POSTSERVICEHOOK KeWin32PostServiceHook;
215 #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