9ee0dd574cd6994b952c99e269cf43a175ad5706
[reactos.git] / reactos / include / reactos / windbgkd.h
1 #ifndef _WINDBGKD_
2 #define _WINDBGKD_
3
4 //
5 // Dependencies
6 //
7 #include "wdbgexts.h"
8
9 //
10 // Conversion Macros
11 //
12 #define COPYSE(p64, p32, f) \
13 p64->f = (ULONG64)(LONG64)(LONG)p32->f
14
15 //
16 // Packet Size and Control Stream Size
17 //
18 #define PACKET_MAX_SIZE 4000
19 #define DBGKD_MAXSTREAM 16
20
21 //
22 // Magic Packet IDs
23 //
24 #define INITIAL_PACKET_ID 0x80800000
25 #define SYNC_PACKET_ID 0x00000800
26
27 //
28 // Magic Packet bytes
29 //
30 #define BREAKIN_PACKET 0x62626262
31 #define BREAKIN_PACKET_BYTE 0x62
32 #define PACKET_LEADER 0x30303030
33 #define PACKET_LEADER_BYTE 0x30
34 #define CONTROL_PACKET_LEADER 0x69696969
35 #define CONTROL_PACKET_LEADER_BYTE 0x69
36 #define PACKET_TRAILING_BYTE 0xAA
37
38 //
39 // Packet Types
40 //
41 #define PACKET_TYPE_UNUSED 0
42 #define PACKET_TYPE_KD_STATE_CHANGE32 1
43 #define PACKET_TYPE_KD_STATE_MANIPULATE 2
44 #define PACKET_TYPE_KD_DEBUG_IO 3
45 #define PACKET_TYPE_KD_ACKNOWLEDGE 4
46 #define PACKET_TYPE_KD_RESEND 5
47 #define PACKET_TYPE_KD_RESET 6
48 #define PACKET_TYPE_KD_STATE_CHANGE64 7
49 #define PACKET_TYPE_KD_POLL_BREAKIN 8
50 #define PACKET_TYPE_KD_TRACE_IO 9
51 #define PACKET_TYPE_KD_CONTROL_REQUEST 10
52 #define PACKET_TYPE_KD_FILE_IO 11
53 #define PACKET_TYPE_MAX 12
54
55 //
56 // Wait State Change Types
57 //
58 #define DbgKdMinimumStateChange 0x00003030
59 #define DbgKdExceptionStateChange 0x00003030
60 #define DbgKdLoadSymbolsStateChange 0x00003031
61 #define DbgKdCommandStringStateChange 0x00003032
62 #define DbgKdMaximumStateChange 0x00003033
63
64 //
65 // This is combined with the basic state change code
66 // if the state is from an alternate source
67 //
68 #define DbgKdAlternateStateChange 0x00010000
69
70 //
71 // Manipulate Types
72 //
73 #define DbgKdMinimumManipulate 0x00003130
74 #define DbgKdReadVirtualMemoryApi 0x00003130
75 #define DbgKdWriteVirtualMemoryApi 0x00003131
76 #define DbgKdGetContextApi 0x00003132
77 #define DbgKdSetContextApi 0x00003133
78 #define DbgKdWriteBreakPointApi 0x00003134
79 #define DbgKdRestoreBreakPointApi 0x00003135
80 #define DbgKdContinueApi 0x00003136
81 #define DbgKdReadControlSpaceApi 0x00003137
82 #define DbgKdWriteControlSpaceApi 0x00003138
83 #define DbgKdReadIoSpaceApi 0x00003139
84 #define DbgKdWriteIoSpaceApi 0x0000313A
85 #define DbgKdRebootApi 0x0000313B
86 #define DbgKdContinueApi2 0x0000313C
87 #define DbgKdReadPhysicalMemoryApi 0x0000313D
88 #define DbgKdWritePhysicalMemoryApi 0x0000313E
89 #define DbgKdQuerySpecialCallsApi 0x0000313F
90 #define DbgKdSetSpecialCallApi 0x00003140
91 #define DbgKdClearSpecialCallsApi 0x00003141
92 #define DbgKdSetInternalBreakPointApi 0x00003142
93 #define DbgKdGetInternalBreakPointApi 0x00003143
94 #define DbgKdReadIoSpaceExtendedApi 0x00003144
95 #define DbgKdWriteIoSpaceExtendedApi 0x00003145
96 #define DbgKdGetVersionApi 0x00003146
97 #define DbgKdWriteBreakPointExApi 0x00003147
98 #define DbgKdRestoreBreakPointExApi 0x00003148
99 #define DbgKdCauseBugCheckApi 0x00003149
100 #define DbgKdSwitchProcessor 0x00003150
101 #define DbgKdPageInApi 0x00003151
102 #define DbgKdReadMachineSpecificRegister 0x00003152
103 #define DbgKdWriteMachineSpecificRegister 0x00003153
104 #define OldVlm1 0x00003154
105 #define OldVlm2 0x00003155
106 #define DbgKdSearchMemoryApi 0x00003156
107 #define DbgKdGetBusDataApi 0x00003157
108 #define DbgKdSetBusDataApi 0x00003158
109 #define DbgKdCheckLowMemoryApi 0x00003159
110 #define DbgKdClearAllInternalBreakpointsApi 0x0000315A
111 #define DbgKdFillMemoryApi 0x0000315B
112 #define DbgKdQueryMemoryApi 0x0000315C
113 #define DbgKdSwitchPartition 0x0000315D
114 #define DbgKdMaximumManipulate 0x0000315E
115
116 //
117 // Debug I/O Types
118 //
119 #define DbgKdPrintStringApi 0x00003230
120 #define DbgKdGetStringApi 0x00003231
121
122 //
123 // Trace I/O Types
124 //
125 #define DbgKdPrintTraceApi 0x00003330
126
127 //
128 // Control Request Types
129 //
130 #define DbgKdRequestHardwareBp 0x00004300
131 #define DbgKdReleaseHardwareBp 0x00004301
132
133 //
134 // File I/O Types
135 //
136 #define DbgKdCreateFileApi 0x00003430
137 #define DbgKdReadFileApi 0x00003431
138 #define DbgKdWriteFileApi 0x00003432
139 #define DbgKdCloseFileApi 0x00003433
140
141 //
142 // Control Report Flags
143 //
144 #define REPORT_INCLUDES_SEGS 0x0001
145 #define REPORT_INCLUDES_CS 0x0002
146
147 //
148 // Protocol Versions
149 //
150 #define DBGKD_64BIT_PROTOCOL_VERSION1 5
151 #define DBGKD_64BIT_PROTOCOL_VERSION2 6
152
153 //
154 // Query Memory Address Spaces
155 //
156 #define DBGKD_QUERY_MEMORY_VIRTUAL 0
157 #define DBGKD_QUERY_MEMORY_PROCESS 0
158 #define DBGKD_QUERY_MEMORY_SESSION 1
159 #define DBGKD_QUERY_MEMORY_KERNEL 2
160
161 //
162 // Query Memory Flags
163 //
164 #define DBGKD_QUERY_MEMORY_READ 0x01
165 #define DBGKD_QUERY_MEMORY_WRITE 0x02
166 #define DBGKD_QUERY_MEMORY_EXECUTE 0x04
167 #define DBGKD_QUERY_MEMORY_FIXED 0x08
168
169 //
170 // Internal Breakpoint Flags
171 //
172 #define DBGKD_INTERNAL_BP_FLAG_COUNTONLY 0x01
173 #define DBGKD_INTERNAL_BP_FLAG_INVALID 0x02
174 #define DBGKD_INTERNAL_BP_FLAG_SUSPENDED 0x04
175 #define DBGKD_INTERNAL_BP_FLAG_DYING 0x08
176
177 //
178 // Fill Memory Flags
179 //
180 #define DBGKD_FILL_MEMORY_VIRTUAL 0x01
181 #define DBGKD_FILL_MEMORY_PHYSICAL 0x02
182
183 //
184 // Physical Memory Caching Flags
185 //
186 #define DBGKD_CACHING_DEFAULT 0
187 #define DBGKD_CACHING_CACHED 1
188 #define DBGKD_CACHING_UNCACHED 2
189 #define DBGKD_CACHING_WRITE_COMBINED 3
190
191 //
192 // Partition Switch Flags
193 //
194 #define DBGKD_PARTITION_DEFAULT 0x00
195 #define DBGKD_PARTITION_ALTERNATE 0x01
196
197 //
198 // KD Packet Structure
199 //
200 typedef struct _KD_PACKET
201 {
202 ULONG PacketLeader;
203 USHORT PacketType;
204 USHORT ByteCount;
205 ULONG PacketId;
206 ULONG Checksum;
207 } KD_PACKET, *PKD_PACKET;
208
209 //
210 // KD Context
211 //
212 typedef struct _KD_CONTEXT
213 {
214 ULONG KdpDefaultRetries;
215 BOOLEAN KdpControlCPending;
216 } KD_CONTEXT, *PKD_CONTEXT;
217
218 //
219 // Control Sets for Supported Architectures
220 //
221 #include <pshpack4.h>
222 typedef struct _X86_DBGKD_CONTROL_SET
223 {
224 ULONG TraceFlag;
225 ULONG Dr7;
226 ULONG CurrentSymbolStart;
227 ULONG CurrentSymbolEnd;
228 } X86_DBGKD_CONTROL_SET, *PX86_DBGKD_CONTROL_SET;
229
230 typedef struct _IA64_DBGKD_CONTROL_SET
231 {
232 ULONG Continue;
233 ULONG64 CurrentSymbolStart;
234 ULONG64 CurrentSymbolEnd;
235 } IA64_DBGKD_CONTROL_SET, *PIA64_DBGKD_CONTROL_SET;
236
237 typedef struct _AMD64_DBGKD_CONTROL_SET
238 {
239 ULONG TraceFlag;
240 ULONG64 Dr7;
241 ULONG64 CurrentSymbolStart;
242 ULONG64 CurrentSymbolEnd;
243 } AMD64_DBGKD_CONTROL_SET, *PAMD64_DBGKD_CONTROL_SET;
244
245 typedef struct _ARM_DBGKD_CONTROL_SET
246 {
247 ULONG Continue;
248 ULONG CurrentSymbolStart;
249 ULONG CurrentSymbolEnd;
250 } ARM_DBGKD_CONTROL_SET, *PARM_DBGKD_CONTROL_SET;
251
252 typedef struct _DBGKD_ANY_CONTROL_SET
253 {
254 union
255 {
256 X86_DBGKD_CONTROL_SET X86ControlSet;
257 IA64_DBGKD_CONTROL_SET IA64ControlSet;
258 AMD64_DBGKD_CONTROL_SET Amd64ControlSet;
259 ARM_DBGKD_CONTROL_SET ArmControlSet;
260 };
261 } DBGKD_ANY_CONTROL_SET, *PDBGKD_ANY_CONTROL_SET;
262 #include <poppack.h>
263
264 typedef X86_DBGKD_CONTROL_SET DBGKD_CONTROL_SET, *PDBGKD_CONTROL_SET;
265
266 //
267 // DBGKM Structure for Exceptions
268 //
269 typedef struct _DBGKM_EXCEPTION32
270 {
271 EXCEPTION_RECORD32 ExceptionRecord;
272 ULONG FirstChance;
273 } DBGKM_EXCEPTION32, *PDBGKM_EXCEPTION32;
274
275 typedef struct _DBGKM_EXCEPTION64
276 {
277 EXCEPTION_RECORD64 ExceptionRecord;
278 ULONG FirstChance;
279 } DBGKM_EXCEPTION64, *PDBGKM_EXCEPTION64;
280
281 //
282 // DBGKD Structure for State Change
283 //
284 typedef struct _X86_DBGKD_CONTROL_REPORT
285 {
286 ULONG Dr6;
287 ULONG Dr7;
288 USHORT InstructionCount;
289 USHORT ReportFlags;
290 UCHAR InstructionStream[DBGKD_MAXSTREAM];
291 USHORT SegCs;
292 USHORT SegDs;
293 USHORT SegEs;
294 USHORT SegFs;
295 ULONG EFlags;
296 } X86_DBGKD_CONTROL_REPORT, *PX86_DBGKD_CONTROL_REPORT;
297
298 typedef struct _ALPHA_DBGKD_CONTROL_REPORT
299 {
300 ULONG InstructionCount;
301 UCHAR InstructionStream[DBGKD_MAXSTREAM];
302 } ALPHA_DBGKD_CONTROL_REPORT, *PALPHA_DBGKD_CONTROL_REPORT;
303
304 typedef struct _IA64_DBGKD_CONTROL_REPORT
305 {
306 ULONG InstructionCount;
307 UCHAR InstructionStream[DBGKD_MAXSTREAM];
308 } IA64_DBGKD_CONTROL_REPORT, *PIA64_DBGKD_CONTROL_REPORT;
309
310 typedef struct _AMD64_DBGKD_CONTROL_REPORT
311 {
312 ULONG64 Dr6;
313 ULONG64 Dr7;
314 ULONG EFlags;
315 USHORT InstructionCount;
316 USHORT ReportFlags;
317 UCHAR InstructionStream[DBGKD_MAXSTREAM];
318 USHORT SegCs;
319 USHORT SegDs;
320 USHORT SegEs;
321 USHORT SegFs;
322 } AMD64_DBGKD_CONTROL_REPORT, *PAMD64_DBGKD_CONTROL_REPORT;
323
324 typedef X86_DBGKD_CONTROL_REPORT DBGKD_CONTROL_REPORT;
325
326 typedef struct _DBGKD_ANY_CONTROL_REPORT
327 {
328 union
329 {
330 X86_DBGKD_CONTROL_REPORT X86ControlReport;
331 ALPHA_DBGKD_CONTROL_REPORT AlphaControlReport;
332 IA64_DBGKD_CONTROL_REPORT IA64ControlReport;
333 AMD64_DBGKD_CONTROL_REPORT Amd64ControlReport;
334 };
335 } DBGKD_ANY_CONTROL_REPORT, *PDBGKD_ANY_CONTROL_REPORT;
336
337 //
338 // DBGKD Structure for Debug I/O Type Print String
339 //
340 typedef struct _DBGKD_PRINT_STRING
341 {
342 ULONG LengthOfString;
343 } DBGKD_PRINT_STRING, *PDBGKD_PRINT_STRING;
344
345 //
346 // DBGKD Structure for Debug I/O Type Get String
347 //
348 typedef struct _DBGKD_GET_STRING
349 {
350 ULONG LengthOfPromptString;
351 ULONG LengthOfStringRead;
352 } DBGKD_GET_STRING, *PDBGKD_GET_STRING;
353
354 //
355 // DBGKD Structure for Debug I/O
356 //
357 typedef struct _DBGKD_DEBUG_IO
358 {
359 ULONG ApiNumber;
360 USHORT ProcessorLevel;
361 USHORT Processor;
362 union
363 {
364 DBGKD_PRINT_STRING PrintString;
365 DBGKD_GET_STRING GetString;
366 } u;
367 } DBGKD_DEBUG_IO, *PDBGKD_DEBUG_IO;
368
369 //
370 // DBGkD Structure for Command String
371 //
372 typedef struct _DBGKD_COMMAND_STRING
373 {
374 ULONG Flags;
375 ULONG Reserved1;
376 ULONG64 Reserved2[7];
377 } DBGKD_COMMAND_STRING, *PDBGKD_COMMAND_STRING;
378
379 //
380 // DBGKD Structure for Load Symbols
381 //
382 typedef struct _DBGKD_LOAD_SYMBOLS32
383 {
384 ULONG PathNameLength;
385 ULONG BaseOfDll;
386 ULONG ProcessId;
387 ULONG CheckSum;
388 ULONG SizeOfImage;
389 BOOLEAN UnloadSymbols;
390 } DBGKD_LOAD_SYMBOLS32, *PDBGKD_LOAD_SYMBOLS32;
391
392 typedef struct _DBGKD_LOAD_SYMBOLS64
393 {
394 ULONG PathNameLength;
395 ULONG64 BaseOfDll;
396 ULONG64 ProcessId;
397 ULONG CheckSum;
398 ULONG SizeOfImage;
399 BOOLEAN UnloadSymbols;
400 } DBGKD_LOAD_SYMBOLS64, *PDBGKD_LOAD_SYMBOLS64;
401
402 //
403 // DBGKD Structure for Wait State Change
404 //
405
406 typedef struct _DBGKD_WAIT_STATE_CHANGE32
407 {
408 ULONG NewState;
409 USHORT ProcessorLevel;
410 USHORT Processor;
411 ULONG NumberProcessors;
412 ULONG Thread;
413 ULONG ProgramCounter;
414 union
415 {
416 DBGKM_EXCEPTION32 Exception;
417 DBGKD_LOAD_SYMBOLS32 LoadSymbols;
418 } u;
419 DBGKD_CONTROL_REPORT ControlReport;
420 CONTEXT Context;
421 } DBGKD_WAIT_STATE_CHANGE32, *PDBGKD_WAIT_STATE_CHANGE32;
422
423 typedef struct _DBGKD_WAIT_STATE_CHANGE64
424 {
425 ULONG NewState;
426 USHORT ProcessorLevel;
427 USHORT Processor;
428 ULONG NumberProcessors;
429 ULONG64 Thread;
430 ULONG64 ProgramCounter;
431 union
432 {
433 DBGKM_EXCEPTION64 Exception;
434 DBGKD_LOAD_SYMBOLS64 LoadSymbols;
435 } u;
436 DBGKD_CONTROL_REPORT ControlReport;
437 CONTEXT Context;
438 } DBGKD_WAIT_STATE_CHANGE64, *PDBGKD_WAIT_STATE_CHANGE64;
439
440 typedef struct _DBGKD_ANY_WAIT_STATE_CHANGE
441 {
442 ULONG NewState;
443 USHORT ProcessorLevel;
444 USHORT Processor;
445 ULONG NumberProcessors;
446 ULONG64 Thread;
447 ULONG64 ProgramCounter;
448 union
449 {
450 DBGKM_EXCEPTION64 Exception;
451 DBGKD_LOAD_SYMBOLS64 LoadSymbols;
452 DBGKD_COMMAND_STRING CommandString;
453 } u;
454 union
455 {
456 DBGKD_CONTROL_REPORT ControlReport;
457 DBGKD_ANY_CONTROL_REPORT AnyControlReport;
458 };
459 } DBGKD_ANY_WAIT_STATE_CHANGE, *PDBGKD_ANY_WAIT_STATE_CHANGE;
460
461 //
462 // DBGKD Manipulate Structures
463 //
464 typedef struct _DBGKD_READ_MEMORY32
465 {
466 ULONG TargetBaseAddress;
467 ULONG TransferCount;
468 ULONG ActualBytesRead;
469 } DBGKD_READ_MEMORY32, *PDBGKD_READ_MEMORY32;
470
471 typedef struct _DBGKD_READ_MEMORY64
472 {
473 ULONG64 TargetBaseAddress;
474 ULONG TransferCount;
475 ULONG ActualBytesRead;
476 } DBGKD_READ_MEMORY64, *PDBGKD_READ_MEMORY64;
477
478 typedef struct _DBGKD_WRITE_MEMORY32
479 {
480 ULONG TargetBaseAddress;
481 ULONG TransferCount;
482 ULONG ActualBytesWritten;
483 } DBGKD_WRITE_MEMORY32, *PDBGKD_WRITE_MEMORY32;
484
485 typedef struct _DBGKD_WRITE_MEMORY64
486 {
487 ULONG64 TargetBaseAddress;
488 ULONG TransferCount;
489 ULONG ActualBytesWritten;
490 } DBGKD_WRITE_MEMORY64, *PDBGKD_WRITE_MEMORY64;
491
492 typedef struct _DBGKD_GET_CONTEXT
493 {
494 ULONG Unused;
495 } DBGKD_GET_CONTEXT, *PDBGKD_GET_CONTEXT;
496
497 typedef struct _DBGKD_SET_CONTEXT
498 {
499 ULONG ContextFlags;
500 } DBGKD_SET_CONTEXT, *PDBGKD_SET_CONTEXT;
501
502 typedef struct _DBGKD_WRITE_BREAKPOINT32
503 {
504 ULONG BreakPointAddress;
505 ULONG BreakPointHandle;
506 } DBGKD_WRITE_BREAKPOINT32, *PDBGKD_WRITE_BREAKPOINT32;
507
508 typedef struct _DBGKD_WRITE_BREAKPOINT64
509 {
510 ULONG64 BreakPointAddress;
511 ULONG BreakPointHandle;
512 } DBGKD_WRITE_BREAKPOINT64, *PDBGKD_WRITE_BREAKPOINT64;
513
514 typedef struct _DBGKD_RESTORE_BREAKPOINT
515 {
516 ULONG BreakPointHandle;
517 } DBGKD_RESTORE_BREAKPOINT, *PDBGKD_RESTORE_BREAKPOINT;
518
519 typedef struct _DBGKD_CONTINUE
520 {
521 NTSTATUS ContinueStatus;
522 } DBGKD_CONTINUE, *PDBGKD_CONTINUE;
523
524 #include <pshpack4.h>
525 typedef struct _DBGKD_CONTINUE2
526 {
527 NTSTATUS ContinueStatus;
528 union
529 {
530 DBGKD_CONTROL_SET ControlSet;
531 DBGKD_ANY_CONTROL_SET AnyControlSet;
532 };
533 } DBGKD_CONTINUE2, *PDBGKD_CONTINUE2;
534 #include <poppack.h>
535
536 typedef struct _DBGKD_READ_WRITE_IO32
537 {
538 ULONG IoAddress;
539 ULONG DataSize;
540 ULONG DataValue;
541 } DBGKD_READ_WRITE_IO32, *PDBGKD_READ_WRITE_IO32;
542
543 typedef struct _DBGKD_READ_WRITE_IO64
544 {
545 ULONG64 IoAddress;
546 ULONG DataSize;
547 ULONG DataValue;
548 } DBGKD_READ_WRITE_IO64, *PDBGKD_READ_WRITE_IO64;
549
550 typedef struct _DBGKD_READ_WRITE_IO_EXTENDED32
551 {
552 ULONG DataSize;
553 ULONG InterfaceType;
554 ULONG BusNumber;
555 ULONG AddressSpace;
556 ULONG IoAddress;
557 ULONG DataValue;
558 } DBGKD_READ_WRITE_IO_EXTENDED32, *PDBGKD_READ_WRITE_IO_EXTENDED32;
559
560 typedef struct _DBGKD_READ_WRITE_IO_EXTENDED64
561 {
562 ULONG DataSize;
563 ULONG InterfaceType;
564 ULONG BusNumber;
565 ULONG AddressSpace;
566 ULONG64 IoAddress;
567 ULONG DataValue;
568 } DBGKD_READ_WRITE_IO_EXTENDED64, *PDBGKD_READ_WRITE_IO_EXTENDED64;
569
570 typedef struct _DBGKD_READ_WRITE_MSR
571 {
572 ULONG Msr;
573 ULONG DataValueLow;
574 ULONG DataValueHigh;
575 } DBGKD_READ_WRITE_MSR, *PDBGKD_READ_WRITE_MSR;
576
577 typedef struct _DBGKD_QUERY_SPECIAL_CALLS
578 {
579 ULONG NumberOfSpecialCalls;
580 } DBGKD_QUERY_SPECIAL_CALLS, *PDBGKD_QUERY_SPECIAL_CALLS;
581
582 typedef struct _DBGKD_SET_SPECIAL_CALL32
583 {
584 ULONG SpecialCall;
585 } DBGKD_SET_SPECIAL_CALL32, *PDBGKD_SET_SPECIAL_CALL32;
586
587 typedef struct _DBGKD_SET_SPECIAL_CALL64
588 {
589 ULONG64 SpecialCall;
590 } DBGKD_SET_SPECIAL_CALL64, *PDBGKD_SET_SPECIAL_CALL64;
591
592 typedef struct _DBGKD_SET_INTERNAL_BREAKPOINT32
593 {
594 ULONG BreakpointAddress;
595 ULONG Flags;
596 } DBGKD_SET_INTERNAL_BREAKPOINT32, *PDBGKD_SET_INTERNAL_BREAKPOINT32;
597
598 typedef struct _DBGKD_SET_INTERNAL_BREAKPOINT64
599 {
600 ULONG64 BreakpointAddress;
601 ULONG Flags;
602 } DBGKD_SET_INTERNAL_BREAKPOINT64, *PDBGKD_SET_INTERNAL_BREAKPOINT64;
603
604 typedef struct _DBGKD_GET_INTERNAL_BREAKPOINT32
605 {
606 ULONG BreakpointAddress;
607 ULONG Flags;
608 ULONG Calls;
609 ULONG MaxCallsPerPeriod;
610 ULONG MinInstructions;
611 ULONG MaxInstructions;
612 ULONG TotalInstructions;
613 } DBGKD_GET_INTERNAL_BREAKPOINT32, *PDBGKD_GET_INTERNAL_BREAKPOINT32;
614
615 typedef struct _DBGKD_GET_INTERNAL_BREAKPOINT64
616 {
617 ULONG64 BreakpointAddress;
618 ULONG Flags;
619 ULONG Calls;
620 ULONG MaxCallsPerPeriod;
621 ULONG MinInstructions;
622 ULONG MaxInstructions;
623 ULONG TotalInstructions;
624 } DBGKD_GET_INTERNAL_BREAKPOINT64, *PDBGKD_GET_INTERNAL_BREAKPOINT64;
625
626 typedef struct _DBGKD_BREAKPOINTEX
627 {
628 ULONG BreakPointCount;
629 NTSTATUS ContinueStatus;
630 } DBGKD_BREAKPOINTEX, *PDBGKD_BREAKPOINTEX;
631
632 typedef struct _DBGKD_SEARCH_MEMORY
633 {
634 union
635 {
636 ULONG64 SearchAddress;
637 ULONG64 FoundAddress;
638 };
639 ULONG64 SearchLength;
640 ULONG PatternLength;
641 } DBGKD_SEARCH_MEMORY, *PDBGKD_SEARCH_MEMORY;
642
643 typedef struct _DBGKD_GET_SET_BUS_DATA
644 {
645 ULONG BusDataType;
646 ULONG BusNumber;
647 ULONG SlotNumber;
648 ULONG Offset;
649 ULONG Length;
650 } DBGKD_GET_SET_BUS_DATA, *PDBGKD_GET_SET_BUS_DATA;
651
652 typedef struct _DBGKD_FILL_MEMORY
653 {
654 ULONG64 Address;
655 ULONG Length;
656 USHORT Flags;
657 USHORT PatternLength;
658 } DBGKD_FILL_MEMORY, *PDBGKD_FILL_MEMORY;
659
660 typedef struct _DBGKD_QUERY_MEMORY
661 {
662 ULONG64 Address;
663 ULONG64 Reserved;
664 ULONG AddressSpace;
665 ULONG Flags;
666 } DBGKD_QUERY_MEMORY, *PDBGKD_QUERY_MEMORY;
667
668 typedef struct _DBGKD_SWITCH_PARTITION
669 {
670 ULONG Partition;
671 } DBGKD_SWITCH_PARTITION;
672
673 //
674 // DBGKD Structure for Manipulate
675 //
676 typedef struct _DBGKD_MANIPULATE_STATE32
677 {
678 ULONG ApiNumber;
679 USHORT ProcessorLevel;
680 USHORT Processor;
681 NTSTATUS ReturnStatus;
682 union
683 {
684 DBGKD_READ_MEMORY32 ReadMemory;
685 DBGKD_WRITE_MEMORY32 WriteMemory;
686 DBGKD_READ_MEMORY64 ReadMemory64;
687 DBGKD_WRITE_MEMORY64 WriteMemory64;
688 DBGKD_GET_CONTEXT GetContext;
689 DBGKD_SET_CONTEXT SetContext;
690 DBGKD_WRITE_BREAKPOINT32 WriteBreakPoint;
691 DBGKD_RESTORE_BREAKPOINT RestoreBreakPoint;
692 DBGKD_CONTINUE Continue;
693 DBGKD_CONTINUE2 Continue2;
694 DBGKD_READ_WRITE_IO32 ReadWriteIo;
695 DBGKD_READ_WRITE_IO_EXTENDED32 ReadWriteIoExtended;
696 DBGKD_QUERY_SPECIAL_CALLS QuerySpecialCalls;
697 DBGKD_SET_SPECIAL_CALL32 SetSpecialCall;
698 DBGKD_SET_INTERNAL_BREAKPOINT32 SetInternalBreakpoint;
699 DBGKD_GET_INTERNAL_BREAKPOINT32 GetInternalBreakpoint;
700 DBGKD_GET_VERSION32 GetVersion32;
701 DBGKD_BREAKPOINTEX BreakPointEx;
702 DBGKD_READ_WRITE_MSR ReadWriteMsr;
703 DBGKD_SEARCH_MEMORY SearchMemory;
704 DBGKD_GET_SET_BUS_DATA GetSetBusData;
705 DBGKD_FILL_MEMORY FillMemory;
706 DBGKD_QUERY_MEMORY QueryMemory;
707 DBGKD_SWITCH_PARTITION SwitchPartition;
708 } u;
709 } DBGKD_MANIPULATE_STATE32, *PDBGKD_MANIPULATE_STATE32;
710
711 typedef struct _DBGKD_MANIPULATE_STATE64
712 {
713 ULONG ApiNumber;
714 USHORT ProcessorLevel;
715 USHORT Processor;
716 NTSTATUS ReturnStatus;
717 union
718 {
719 DBGKD_READ_MEMORY64 ReadMemory;
720 DBGKD_WRITE_MEMORY64 WriteMemory;
721 DBGKD_GET_CONTEXT GetContext;
722 DBGKD_SET_CONTEXT SetContext;
723 DBGKD_WRITE_BREAKPOINT64 WriteBreakPoint;
724 DBGKD_RESTORE_BREAKPOINT RestoreBreakPoint;
725 DBGKD_CONTINUE Continue;
726 DBGKD_CONTINUE2 Continue2;
727 DBGKD_READ_WRITE_IO64 ReadWriteIo;
728 DBGKD_READ_WRITE_IO_EXTENDED64 ReadWriteIoExtended;
729 DBGKD_QUERY_SPECIAL_CALLS QuerySpecialCalls;
730 DBGKD_SET_SPECIAL_CALL64 SetSpecialCall;
731 DBGKD_SET_INTERNAL_BREAKPOINT64 SetInternalBreakpoint;
732 DBGKD_GET_INTERNAL_BREAKPOINT64 GetInternalBreakpoint;
733 DBGKD_GET_VERSION64 GetVersion64;
734 DBGKD_BREAKPOINTEX BreakPointEx;
735 DBGKD_READ_WRITE_MSR ReadWriteMsr;
736 DBGKD_SEARCH_MEMORY SearchMemory;
737 DBGKD_GET_SET_BUS_DATA GetSetBusData;
738 DBGKD_FILL_MEMORY FillMemory;
739 DBGKD_QUERY_MEMORY QueryMemory;
740 DBGKD_SWITCH_PARTITION SwitchPartition;
741 } u;
742 } DBGKD_MANIPULATE_STATE64, *PDBGKD_MANIPULATE_STATE64;
743
744 //
745 // File I/O Structure
746 //
747 typedef struct _DBGKD_CREATE_FILE
748 {
749 ULONG DesiredAccess;
750 ULONG FileAttributes;
751 ULONG ShareAccess;
752 ULONG CreateDisposition;
753 ULONG CreateOptions;
754 ULONG64 Handle;
755 ULONG64 Length;
756 } DBGKD_CREATE_FILE, *PDBGKD_CREATE_FILE;
757
758 typedef struct _DBGKD_READ_FILE
759 {
760 ULONG64 Handle;
761 ULONG64 Offset;
762 ULONG Length;
763 } DBGKD_READ_FILE, *PDBGKD_READ_FILE;
764
765 typedef struct _DBGKD_WRITE_FILE
766 {
767 ULONG64 Handle;
768 ULONG64 Offset;
769 ULONG Length;
770 } DBGKD_WRITE_FILE, *PDBGKD_WRITE_FILE;
771
772 typedef struct _DBGKD_CLOSE_FILE
773 {
774 ULONG64 Handle;
775 } DBGKD_CLOSE_FILE, *PDBGKD_CLOSE_FILE;
776
777 typedef struct _DBGKD_FILE_IO
778 {
779 ULONG ApiNumber;
780 ULONG Status;
781 union
782 {
783 ULONG64 ReserveSpace[7];
784 DBGKD_CREATE_FILE CreateFile;
785 DBGKD_READ_FILE ReadFile;
786 DBGKD_WRITE_FILE WriteFile;
787 DBGKD_CLOSE_FILE CloseFile;
788 } u;
789 } DBGKD_FILE_IO, *PDBGKD_FILE_IO;
790
791
792 //
793 // Control Request Structure
794 //
795 typedef struct _DBGKD_REQUEST_BREAKPOINT
796 {
797 ULONG HardwareBreakPointNumber;
798 ULONG Available;
799 } DBGKD_REQUEST_BREAKPOINT, *PDBGKD_REQUEST_BREAKPOINT;
800
801 typedef struct _DBGKD_RELEASE_BREAKPOINT
802 {
803 ULONG HardwareBreakPointNumber;
804 ULONG Released;
805 } DBGKD_RELEASE_BREAKPOINT, *PDBGKD_RELEASE_BREAKPOINT;
806
807 typedef struct _DBGKD_CONTROL_REQUEST
808 {
809 ULONG ApiNumber;
810 union
811 {
812 DBGKD_REQUEST_BREAKPOINT RequestBreakpoint;
813 DBGKD_RELEASE_BREAKPOINT ReleaseBreakpoint;
814 } u;
815 } DBGKD_CONTROL_REQUEST, *PDBGKD_CONTROL_REQUEST;
816
817 //
818 // Trace I/O Structure
819 //
820 typedef struct _DBGKD_PRINT_TRACE
821 {
822 ULONG LengthOfData;
823 } DBGKD_PRINT_TRACE, *PDBGKD_PRINT_TRACE;
824
825 typedef struct _DBGKD_TRACE_IO
826 {
827 ULONG ApiNumber;
828 USHORT ProcessorLevel;
829 USHORT Processor;
830 union
831 {
832 ULONG64 ReserveSpace[7];
833 DBGKD_PRINT_TRACE PrintTrace;
834 } u;
835 } DBGKD_TRACE_IO, *PDBGKD_TRACE_IO;
836
837 FORCEINLINE
838 VOID
839 ExceptionRecord32To64(IN PEXCEPTION_RECORD32 Ex32,
840 OUT PEXCEPTION_RECORD64 Ex64)
841 {
842 ULONG i;
843
844 Ex64->ExceptionCode = Ex32->ExceptionCode;
845 Ex64->ExceptionFlags = Ex32->ExceptionFlags;
846 Ex64->ExceptionRecord = Ex32->ExceptionRecord;
847 COPYSE(Ex64,Ex32,ExceptionAddress);
848 Ex64->NumberParameters = Ex32->NumberParameters;
849
850 for (i = 0; i < EXCEPTION_MAXIMUM_PARAMETERS; i++)
851 {
852 COPYSE(Ex64,Ex32,ExceptionInformation[i]);
853 }
854 }
855
856 #endif