ReactOS 0.4.15-dev-5853-gcb454ef
kdio.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: ntoskrnl/kd/kdio.c
5 * PURPOSE: NT Kernel Debugger Input/Output Functions
6 *
7 * PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
8 */
9
10/* INCLUDES ******************************************************************/
11
12#include <ntoskrnl.h>
13#include <reactos/buildno.h>
14
15#define NDEBUG
16#include <debug.h>
17
18/* GLOBALS *******************************************************************/
19
20#define KdpBufferSize (1024 * 512)
23static volatile ULONG KdpCurrentPosition = 0;
24static volatile ULONG KdpFreeBytes = 0;
28ANSI_STRING KdpLogFileName = RTL_CONSTANT_STRING("\\SystemRoot\\debug.log");
29
33
34#define KdpScreenLineLengthDefault 80
37
38KDP_DEBUG_MODE KdpDebugMode;
40KD_DISPATCH_TABLE DispatchTable[KdMax] = {0};
41
42PKDP_INIT_ROUTINE InitRoutines[KdMax] =
43{
47#ifdef KDBG // See kdb_cli.c
48 KdpKdbgInit
49#endif
50};
51
57
58/* LOCKING FUNCTIONS *********************************************************/
59
64{
66
67 /* Acquire the spinlock without waiting at raised IRQL */
68 while (TRUE)
69 {
70 /* Loop until the spinlock becomes available */
71 while (!KeTestSpinLock(SpinLock));
72
73 /* Spinlock is free, raise IRQL to high level */
75
76 /* Try to get the spinlock */
78 break;
79
80 /* Someone else got the spinlock, lower IRQL back */
82 }
83
84 return OldIrql;
85}
86
87VOID
92{
93 /* Release the spinlock */
95 // KeReleaseSpinLockFromDpcLevel(SpinLock);
96
97 /* Restore the old IRQL */
99}
100
101/* FILE DEBUG LOG FUNCTIONS **************************************************/
102
103static VOID
104NTAPI
106{
107 ULONG beg, end, num;
109
111
113
114 while (TRUE)
115 {
117
118 /* Bug */
119 /* Keep KdpCurrentPosition and KdpFreeBytes values in local
120 * variables to avoid their possible change from Producer part,
121 * KdpPrintToLogFile function
122 */
125
126 /* Now securely calculate values, based on local variables */
127 beg = (end + num) % KdpBufferSize;
129
130 /* Nothing to do? */
131 if (num == 0)
132 continue;
133
134 if (end > beg)
135 {
137 KdpDebugBuffer + beg, num, NULL, NULL);
138 }
139 else
140 {
142 KdpDebugBuffer + beg, KdpBufferSize - beg, NULL, NULL);
143
146 }
147
149 }
150}
151
152static VOID
153NTAPI
156{
158 ULONG beg, end, num;
159
160 if (KdpDebugBuffer == NULL) return;
161
162 /* Acquire the printing spinlock without waiting at raised IRQL */
164
165 beg = KdpCurrentPosition;
167 if (num != 0)
168 {
169 end = (beg + num) % KdpBufferSize;
171 KdpFreeBytes -= num;
172
173 if (end > beg)
174 {
176 }
177 else
178 {
181 }
182 }
183
184 /* Release the spinlock */
186
187 /* Signal the logger thread */
190}
191
193NTAPI
195 _In_ PKD_DISPATCH_TABLE DispatchTable,
196 _In_ ULONG BootPhase)
197{
199
200 if (!KdpDebugMode.File)
202
203 if (BootPhase == 0)
204 {
205 /* Write out the functions that we support for now */
206 DispatchTable->KdpPrintRoutine = KdpPrintToLogFile;
207
208 /* Register for BootPhase 1 initialization and as a Provider */
209 DispatchTable->KdpInitRoutine = KdpDebugLogInit;
210 InsertTailList(&KdProviders, &DispatchTable->KdProvidersList);
211 }
212 else if (BootPhase == 1)
213 {
214 /* Allocate a buffer for debug log */
215 KdpDebugBuffer = ExAllocatePoolZero(NonPagedPool,
217 TAG_KDBG);
218 if (!KdpDebugBuffer)
219 {
220 KdpDebugMode.File = FALSE;
221 RemoveEntryList(&DispatchTable->KdProvidersList);
222 return STATUS_NO_MEMORY;
223 }
225
226 /* Initialize spinlock */
228
229 /* Register for later BootPhase 2 reinitialization */
230 DispatchTable->KdpInitRoutine = KdpDebugLogInit;
231
232 /* Announce ourselves */
233 HalDisplayString(" File log debugging enabled\r\n");
234 }
235 else if (BootPhase >= 2)
236 {
240 HANDLE ThreadHandle;
242
243 /* If we have already successfully opened the log file, bail out */
244 if (KdpLogFileHandle != NULL)
245 return STATUS_SUCCESS;
246
247 /* Setup the log name */
249 if (!NT_SUCCESS(Status))
250 goto Failure;
251
253 &FileName,
255 NULL,
256 NULL);
257
258 /* Create the log file */
259 Status = ZwCreateFile(&KdpLogFileHandle,
262 &Iosb,
263 NULL,
269 NULL,
270 0);
271
273
274 if (!NT_SUCCESS(Status))
275 {
276 DPRINT1("Failed to open log file: 0x%08lx\n", Status);
277
278 /* Schedule an I/O reinitialization if needed */
281 {
282 DispatchTable->KdpInitRoutine = KdpDebugLogInit;
283 return Status;
284 }
285 goto Failure;
286 }
287
291 {
293 FILE_POSITION_INFORMATION FilePosInfo;
294
295 Status = ZwQueryInformationFile(KdpLogFileHandle,
296 &Iosb,
297 &FileInfo,
298 sizeof(FileInfo),
300 DPRINT("Status: 0x%08lx - EOF offset: %I64d\n",
301 Status, FileInfo.EndOfFile.QuadPart);
302
303 Status = ZwQueryInformationFile(KdpLogFileHandle,
304 &Iosb,
305 &FilePosInfo,
306 sizeof(FilePosInfo),
308 DPRINT("Status: 0x%08lx - Position: %I64d\n",
309 Status, FilePosInfo.CurrentByteOffset.QuadPart);
310
311 FilePosInfo.CurrentByteOffset.QuadPart = FileInfo.EndOfFile.QuadPart;
312 Status = ZwSetInformationFile(KdpLogFileHandle,
313 &Iosb,
314 &FilePosInfo,
315 sizeof(FilePosInfo),
317 DPRINT("ZwSetInformationFile(FilePositionInfo) returned: 0x%08lx\n", Status);
318 }
322
323 /* Create the logger thread */
324 Status = PsCreateSystemThread(&ThreadHandle,
326 NULL,
327 NULL,
328 NULL,
330 NULL);
331 if (!NT_SUCCESS(Status))
332 {
333 DPRINT1("Failed to create log file thread: 0x%08lx\n", Status);
335 goto Failure;
336 }
337
339 ZwSetInformationThread(ThreadHandle,
341 &Priority,
342 sizeof(Priority));
343
344 ZwClose(ThreadHandle);
345 return Status;
346
347Failure:
348 KdpFreeBytes = 0;
351 KdpDebugMode.File = FALSE;
352 RemoveEntryList(&DispatchTable->KdProvidersList);
353 }
354
355 return Status;
356}
357
358/* SERIAL FUNCTIONS **********************************************************/
359
360static VOID
361NTAPI
364{
365 PCHAR pch = String;
367
368 /* Acquire the printing spinlock without waiting at raised IRQL */
370
371 /* Output the string */
372 while (pch < String + Length && *pch)
373 {
374 if (*pch == '\n')
375 {
377 }
379 pch++;
380 }
381
382 /* Release the spinlock */
384}
385
387NTAPI
389 _In_ PKD_DISPATCH_TABLE DispatchTable,
390 _In_ ULONG BootPhase)
391{
392 if (!KdpDebugMode.Serial)
394
395 if (BootPhase == 0)
396 {
397 /* Write out the functions that we support for now */
398 DispatchTable->KdpPrintRoutine = KdpSerialPrint;
399
400 /* Initialize the Port */
402 {
403 KdpDebugMode.Serial = FALSE;
405 }
407
408 /* Initialize spinlock */
410
411 /* Register for BootPhase 1 initialization and as a Provider */
412 DispatchTable->KdpInitRoutine = KdpSerialInit;
413 InsertTailList(&KdProviders, &DispatchTable->KdProvidersList);
414 }
415 else if (BootPhase == 1)
416 {
417 /* Announce ourselves */
418 HalDisplayString(" Serial debugging enabled\r\n");
419 }
420
421 return STATUS_SUCCESS;
422}
423
424/* SCREEN FUNCTIONS **********************************************************/
425
426VOID
428{
429 if (InbvIsBootDriverInstalled() /* &&
430 !InbvCheckDisplayOwnership() */)
431 {
432 /* Acquire ownership and reset the display */
440 }
441}
442
443// extern VOID NTAPI InbvSetDisplayOwnership(IN BOOLEAN DisplayOwned);
444
445VOID
447{
450 {
451 /* Release the display */
452 // InbvSetDisplayOwnership(FALSE);
454 }
455}
456
457static VOID
458NTAPI
461{
462 PCHAR pch = String;
463
464 while (pch < String + Length && *pch)
465 {
466 if (*pch == '\b')
467 {
468 /* HalDisplayString does not support '\b'. Workaround it and use '\r' */
469 if (KdpScreenLineLength > 0)
470 {
471 /* Remove last character from buffer */
474
475 /* Clear row and print line again */
476 HalDisplayString("\r");
478 }
479 }
480 else
481 {
484 }
485
487 {
488 /* Print buffered characters */
491
492 /* Clear line buffer */
493 KdpScreenLineBuffer[0] = '\0';
495 }
496
497 ++pch;
498 }
499
500 /* Print buffered characters */
502 {
505 }
506}
507
509NTAPI
511 _In_ PKD_DISPATCH_TABLE DispatchTable,
512 _In_ ULONG BootPhase)
513{
514 if (!KdpDebugMode.Screen)
516
517 if (BootPhase == 0)
518 {
519 /* Write out the functions that we support for now */
520 DispatchTable->KdpPrintRoutine = KdpScreenPrint;
521
522 /* Register for BootPhase 1 initialization and as a Provider */
523 DispatchTable->KdpInitRoutine = KdpScreenInit;
524 InsertTailList(&KdProviders, &DispatchTable->KdProvidersList);
525 }
526 else if (BootPhase == 1)
527 {
528 /* Take control of the display */
530
531 /* Announce ourselves */
532 HalDisplayString(" Screen debugging enabled\r\n");
533 }
534
535 return STATUS_SUCCESS;
536}
537
538
539/* GENERAL FUNCTIONS *********************************************************/
540
542
543VOID
544NTAPI
546 _In_ ULONG PacketType,
547 _In_ PSTRING MessageHeader,
548 _In_opt_ PSTRING MessageData,
550{
551 if (PacketType == PACKET_TYPE_KD_DEBUG_IO)
552 {
553 ULONG ApiNumber = ((PDBGKD_DEBUG_IO)MessageHeader->Buffer)->ApiNumber;
554 PLIST_ENTRY CurrentEntry;
555 PKD_DISPATCH_TABLE CurrentTable;
556
557 /* Validate API call */
558 if (MessageHeader->Length != sizeof(DBGKD_DEBUG_IO))
559 return;
560 if ((ApiNumber != DbgKdPrintStringApi) &&
561 (ApiNumber != DbgKdGetStringApi))
562 {
563 return;
564 }
565 if (!MessageData)
566 return;
567
568 /* NOTE: MessageData->Length should be equal to
569 * DebugIo.u.PrintString.LengthOfString, or to
570 * DebugIo.u.GetString.LengthOfPromptString */
571
572 if (!KdpDebugMode.Value)
573 return;
574
575 /* Call the registered providers */
576 for (CurrentEntry = KdProviders.Flink;
577 CurrentEntry != &KdProviders;
578 CurrentEntry = CurrentEntry->Flink)
579 {
580 CurrentTable = CONTAINING_RECORD(CurrentEntry,
581 KD_DISPATCH_TABLE,
582 KdProvidersList);
583
584 CurrentTable->KdpPrintRoutine(MessageData->Buffer, MessageData->Length);
585 }
586 return;
587 }
588 else if (PacketType == PACKET_TYPE_KD_STATE_CHANGE64)
589 {
590 PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange = (PDBGKD_ANY_WAIT_STATE_CHANGE)MessageHeader->Buffer;
591 if (WaitStateChange->NewState == DbgKdLoadSymbolsStateChange)
592 {
593#ifdef KDBG
594 PLDR_DATA_TABLE_ENTRY LdrEntry;
595 /* Load symbols. Currently implemented only for KDBG! */
596 if (KdbpSymFindModule((PVOID)(ULONG_PTR)WaitStateChange->u.LoadSymbols.BaseOfDll, -1, &LdrEntry))
597 {
598 KdbSymProcessSymbols(LdrEntry, !WaitStateChange->u.LoadSymbols.UnloadSymbols);
599 }
600#endif
601 return;
602 }
603 else if (WaitStateChange->NewState == DbgKdExceptionStateChange)
604 {
608 return;
609 }
610 }
611 else if (PacketType == PACKET_TYPE_KD_STATE_MANIPULATE)
612 {
613 PDBGKD_MANIPULATE_STATE64 ManipulateState = (PDBGKD_MANIPULATE_STATE64)MessageHeader->Buffer;
614 if (ManipulateState->ApiNumber == DbgKdGetContextApi)
615 {
616 KD_CONTINUE_TYPE Result;
617
618#ifdef KDBG
619 /* Check if this is an assertion failure */
621 {
622 /* Bump EIP to the instruction following the int 2C */
624 }
625
627 KdbgContext.SegCs & 1,
630#else
631 /* We'll manually dump the stack for the user... */
633 Result = kdHandleException;
634#endif
635 if (Result != kdHandleException)
637 else
640 return;
641 }
642 else if (ManipulateState->ApiNumber == DbgKdSetContextApi)
643 {
645 return;
646 }
647 }
649}
650
652NTAPI
654 _In_ ULONG PacketType,
655 _Out_ PSTRING MessageHeader,
656 _Out_ PSTRING MessageData,
659{
660#ifdef KDBG
662 STRING ResponseString;
663 PDBGKD_DEBUG_IO DebugIo;
664 CHAR MessageBuffer[512];
665#endif
666
667 if (PacketType == PACKET_TYPE_KD_STATE_MANIPULATE)
668 {
669 PDBGKD_MANIPULATE_STATE64 ManipulateState = (PDBGKD_MANIPULATE_STATE64)MessageHeader->Buffer;
670 RtlZeroMemory(MessageHeader->Buffer, MessageHeader->MaximumLength);
672 {
673 ManipulateState->ApiNumber = DbgKdGetContextApi;
674 MessageData->Length = 0;
675 MessageData->Buffer = (PCHAR)&KdbgContext;
676 return KdPacketReceived;
677 }
679 {
680 ManipulateState->ApiNumber = DbgKdSetContextApi;
681 MessageData->Length = sizeof(KdbgContext);
682 MessageData->Buffer = (PCHAR)&KdbgContext;
683 return KdPacketReceived;
684 }
686 {
688 }
689 ManipulateState->ApiNumber = DbgKdContinueApi;
690 ManipulateState->u.Continue.ContinueStatus = KdbgContinueStatus;
691
692 /* Prepare for next time */
695
696 return KdPacketReceived;
697 }
698
699 if (PacketType != PACKET_TYPE_KD_DEBUG_IO)
700 return KdPacketTimedOut;
701
702#ifdef KDBG
703 DebugIo = (PDBGKD_DEBUG_IO)MessageHeader->Buffer;
704
705 /* Validate API call */
706 if (MessageHeader->MaximumLength != sizeof(DBGKD_DEBUG_IO))
707 return KdPacketNeedsResend;
708 if (DebugIo->ApiNumber != DbgKdGetStringApi)
709 return KdPacketNeedsResend;
710
711 /* NOTE: We cannot use directly MessageData->Buffer here as it points
712 * to the temporary KdpMessageBuffer scratch buffer that is being
713 * shared with all the possible I/O KD operations that may happen. */
714 ResponseString.Buffer = MessageBuffer;
715 ResponseString.Length = 0;
716 ResponseString.MaximumLength = min(sizeof(MessageBuffer),
717 MessageData->MaximumLength);
718 ResponseString.MaximumLength = min(ResponseString.MaximumLength,
720
721 /* The prompt string has been printed by KdSendPacket; go to
722 * new line and print the kdb prompt -- for SYSREG2 support. */
724 KdpPrintString(&KdbPromptString); // Alternatively, use "Input> "
725
728
729 /* Read a line of user input and retrieve the length.
730 * The output string is NULL-terminated -- documentation states
731 * that DbgPrompt() does not NULL-terminate, but it does. */
732 *DataLength = KdbpReadCommand(ResponseString.Buffer,
733 ResponseString.MaximumLength);
734
737
738 /* Return the length */
740 MessageData->Length = DebugIo->u.GetString.LengthOfStringRead = *DataLength;
741
742 /* Only now we can copy back the data into MessageData->Buffer */
743 RtlCopyMemory(MessageData->Buffer, ResponseString.Buffer, *DataLength);
744#endif
745
746 return KdPacketReceived;
747}
748
749/* EOF */
unsigned char BOOLEAN
#define VOID
Definition: acefi.h:82
@ NewLine
Definition: asmpp.cpp:33
LONG NTSTATUS
Definition: precomp.h:26
#define FILE_NON_DIRECTORY_FILE
Definition: constants.h:492
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:115
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
Definition: cdrom.h:1444
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
@ ThreadPriority
Definition: compat.h:937
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
LONG KPRIORITY
Definition: compat.h:803
#define FILE_SHARE_READ
Definition: compat.h:136
return Iosb
Definition: create.c:4402
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InsertTailList(ListHead, Entry)
UCHAR KIRQL
Definition: env_spec_w32.h:591
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define HIGH_LEVEL
Definition: env_spec_w32.h:703
KSPIN_LOCK * PKSPIN_LOCK
Definition: env_spec_w32.h:73
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
#define NonPagedPool
Definition: env_spec_w32.h:307
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
#define ExGetPreviousMode
Definition: ex.h:139
#define InterlockedExchangeAddUL(Addend, Value)
Definition: ex.h:1532
struct _FileName FileName
Definition: fatprocs.h:896
std::wstring STRING
Definition: fontsub.cpp:33
@ FilePositionInformation
Definition: from_kernel.h:75
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
#define FILE_WRITE_THROUGH
Definition: from_kernel.h:26
#define FILE_OPEN_IF
Definition: from_kernel.h:56
#define FILE_SEQUENTIAL_ONLY
Definition: from_kernel.h:27
#define KeRosDumpStackFrames(Frames, Count)
Definition: gdidebug.h:11
Status
Definition: gdiplustypes.h:25
GLuint GLuint end
Definition: gl.h:1545
GLuint GLuint num
Definition: glext.h:9618
PUCHAR KdComPortInUse
Definition: usage.c:17
NTHALAPI VOID NTAPI HalDisplayString(PUCHAR String)
VOID NTAPI InbvAcquireDisplayOwnership(VOID)
Definition: inbv.c:289
VOID NTAPI InbvInstallDisplayStringFilter(_In_ INBV_DISPLAY_STRING_FILTER DisplayFilter)
Definition: inbv.c:386
VOID NTAPI InbvNotifyDisplayOwnershipLost(_In_ INBV_RESET_DISPLAY_PARAMETERS Callback)
Definition: inbv.c:403
BOOLEAN NTAPI InbvCheckDisplayOwnership(VOID)
Definition: inbv.c:315
VOID NTAPI InbvSetTextColor(_In_ ULONG Color)
Definition: inbv.c:459
BOOLEAN NTAPI InbvEnableDisplayString(_In_ BOOLEAN Enable)
Definition: inbv.c:369
BOOLEAN NTAPI InbvResetDisplay(VOID)
Definition: inbv.c:430
VOID NTAPI InbvSetScrollRegion(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom)
Definition: inbv.c:447
VOID NTAPI InbvSolidColorFill(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ ULONG Color)
Definition: inbv.c:484
BOOLEAN NTAPI InbvIsBootDriverInstalled(VOID)
Definition: inbv.c:395
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define HIGH_PRIORITY
BOOLEAN NTAPI KdpPrintString(_In_ PSTRING Output)
Definition: kdprint.c:109
BOOLEAN NTAPI KdPortInitializeEx(PCPPORT PortInformation, ULONG ComPortNumber)
VOID NTAPI KdPortPutByteEx(PCPPORT PortInformation, UCHAR ByteToSend)
KD_CONTINUE_TYPE KdbEnterDebuggerException(IN PEXCEPTION_RECORD64 ExceptionRecord, IN KPROCESSOR_MODE PreviousMode, IN PCONTEXT Context, IN BOOLEAN FirstChance)
KDB Exception filter.
Definition: kdb.c:1265
ULONG KdbDebugState
Definition: kdb.c:52
@ KD_DEBUG_KDSERIAL
Definition: kdb.h:57
VOID KdbSymProcessSymbols(_Inout_ PLDR_DATA_TABLE_ENTRY LdrEntry, _In_ BOOLEAN Load)
Load symbols from image mapping. If this fails,.
Definition: kdb_symbols.c:298
BOOLEAN KdbpSymFindModule(IN PVOID Address OPTIONAL, IN INT Index OPTIONAL, OUT PLDR_DATA_TABLE_ENTRY *pLdrEntry)
Find a module...
Definition: kdb_symbols.c:75
VOID KbdDisableMouse(VOID)
Definition: kdb_keyboard.c:98
VOID KbdEnableMouse(VOID)
Definition: kdb_keyboard.c:93
SIZE_T KdbpReadCommand(_Out_ PCHAR Buffer, _In_ SIZE_T Size)
Reads a line of user input from the terminal.
Definition: kdb_cli.c:3351
#define DEFAULT_DEBUG_PORT
Definition: kdcom.c:25
#define DEFAULT_DEBUG_BAUD_RATE
Definition: kdcom.c:28
static VOID NTAPI KdpLoggerThread(PVOID Context)
Definition: kdio.c:105
static volatile ULONG KdpFreeBytes
Definition: kdio.c:24
ULONG SerialPortNumber
Definition: kdio.c:31
static VOID NTAPI KdpScreenPrint(PCHAR String, ULONG Length)
Definition: kdio.c:459
NTSTATUS NTAPI KdpSerialInit(_In_ PKD_DISPATCH_TABLE DispatchTable, _In_ ULONG BootPhase)
Definition: kdio.c:388
static ULONG KdbgNextApiNumber
Definition: kdio.c:52
static HANDLE KdpLogFileHandle
Definition: kdio.c:27
VOID NTAPI KdbpReleaseLock(_In_ PKSPIN_LOCK SpinLock, _In_ KIRQL OldIrql)
Definition: kdio.c:89
LIST_ENTRY KdProviders
Definition: kdio.c:39
static ULONG KdpScreenLineBufferPos
Definition: kdio.c:36
static NTSTATUS KdbgContinueStatus
Definition: kdio.c:56
VOID NTAPI KdSendPacket(_In_ ULONG PacketType, _In_ PSTRING MessageHeader, _In_opt_ PSTRING MessageData, _Inout_ PKD_CONTEXT Context)
Definition: kdio.c:545
KDP_DEBUG_MODE KdpDebugMode
Definition: kdio.c:38
#define KdpBufferSize
Definition: kdio.c:20
KDSTATUS NTAPI KdReceivePacket(_In_ ULONG PacketType, _Out_ PSTRING MessageHeader, _Out_ PSTRING MessageData, _Out_ PULONG DataLength, _Inout_ PKD_CONTEXT Context)
Definition: kdio.c:653
VOID KdpScreenRelease(VOID)
Definition: kdio.c:446
KIRQL NTAPI KdbpAcquireLock(_In_ PKSPIN_LOCK SpinLock)
Definition: kdio.c:62
static PCHAR KdpDebugBuffer
Definition: kdio.c:22
static BOOLEAN KdbgFirstChanceException
Definition: kdio.c:55
static CHAR KdpScreenLineBuffer[KdpScreenLineLengthDefault+1]
Definition: kdio.c:35
static EXCEPTION_RECORD64 KdbgExceptionRecord
Definition: kdio.c:54
PKDP_INIT_ROUTINE InitRoutines[KdMax]
Definition: kdio.c:42
static KSPIN_LOCK KdpSerialSpinLock
Definition: kdio.c:30
NTSTATUS NTAPI KdpScreenInit(_In_ PKD_DISPATCH_TABLE DispatchTable, _In_ ULONG BootPhase)
Definition: kdio.c:510
NTSTATUS NTAPI KdpDebugLogInit(_In_ PKD_DISPATCH_TABLE DispatchTable, _In_ ULONG BootPhase)
Definition: kdio.c:194
static CONTEXT KdbgContext
Definition: kdio.c:53
static KSPIN_LOCK KdpDebugLogSpinLock
Definition: kdio.c:25
static VOID NTAPI KdpPrintToLogFile(PCHAR String, ULONG Length)
Definition: kdio.c:154
static KEVENT KdpLoggerThreadEvent
Definition: kdio.c:26
static ULONG KdpScreenLineLength
Definition: kdio.c:36
VOID KdpScreenAcquire(VOID)
Definition: kdio.c:427
ANSI_STRING KdpLogFileName
Definition: kdio.c:28
static BOOLEAN KdpLoggingEnabled
Definition: kdio.c:21
CPPORT SerialPortInfo
Definition: kdio.c:32
static VOID NTAPI KdpSerialPrint(PCHAR String, ULONG Length)
Definition: kdio.c:362
static volatile ULONG KdpCurrentPosition
Definition: kdio.c:23
#define KdpScreenLineLengthDefault
Definition: kdio.c:34
STRING KdbPromptString
Definition: kdb_cli.c:167
if(dx< 0)
Definition: linetemp.h:194
#define pch(ap)
Definition: match.c:418
#define PCHAR
Definition: match.c:90
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define min(a, b)
Definition: monoChain.cc:55
#define _Inout_
Definition: ms_sal.h:378
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
#define _In_opt_
Definition: ms_sal.h:309
#define KernelMode
Definition: asm.h:34
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define THREAD_ALL_ACCESS
Definition: nt_native.h:1339
#define SYNCHRONIZE
Definition: nt_native.h:61
NTSYSAPI NTSTATUS NTAPI NtWriteFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN PVOID WriteBuffer, IN ULONG WriteBufferLength, IN PLARGE_INTEGER FileOffset OPTIONAL, IN PULONG LockOperationKey OPTIONAL)
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
#define FILE_APPEND_DATA
Definition: nt_native.h:634
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
@ SynchronizationEvent
#define KeSetContextPc(Context, ProgramCounter)
Definition: ke.h:34
#define KeGetContextPc(Context)
Definition: ke.h:31
BOOLEAN FASTCALL KeTestSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:475
BOOLEAN FASTCALL KeTryToAcquireSpinLockAtDpcLevel(IN OUT PKSPIN_LOCK SpinLock)
Definition: spinlock.c:309
VOID FASTCALL KiReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:298
NTSTATUS NTAPI PsCreateSystemThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle, IN PCLIENT_ID ClientId, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
Definition: thread.c:602
#define STATUS_ASSERTION_FAILURE
Definition: ntstatus.h:960
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define STATUS_PORT_DISCONNECTED
Definition: ntstatus.h:291
#define STATUS_DEVICE_DOES_NOT_EXIST
Definition: ntstatus.h:428
#define SCREEN_WIDTH
Definition: pc98video.c:27
#define SCREEN_HEIGHT
Definition: pc98video.c:28
#define FileStandardInformation
Definition: propsheet.cpp:61
#define BV_COLOR_WHITE
Definition: display.h:30
#define BV_COLOR_BLACK
Definition: display.h:15
#define KdPacketReceived
Definition: kddll.h:5
#define KdPacketNeedsResend
Definition: kddll.h:7
ULONG KDSTATUS
Definition: kddll.h:4
#define KdPacketTimedOut
Definition: kddll.h:6
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71
ULONG SegCs
Definition: nt_native.h:1477
PUCHAR Address
Definition: cportlib.h:29
union _DBGKD_ANY_WAIT_STATE_CHANGE::@3510 u
DBGKM_EXCEPTION64 Exception
Definition: windbgkd.h:508
DBGKD_LOAD_SYMBOLS64 LoadSymbols
Definition: windbgkd.h:509
NTSTATUS ContinueStatus
Definition: windbgkd.h:579
DBGKD_GET_STRING GetString
Definition: windbgkd.h:427
ULONG ApiNumber
Definition: windbgkd.h:421
union _DBGKD_DEBUG_IO::@3507 u
ULONG LengthOfStringRead
Definition: windbgkd.h:413
DBGKD_CONTINUE Continue
Definition: windbgkd.h:799
union _DBGKD_MANIPULATE_STATE64::@3518 u
EXCEPTION_RECORD64 ExceptionRecord
Definition: windbgkd.h:312
NTSTATUS ExceptionCode
Definition: rtltypes.h:190
LARGE_INTEGER CurrentByteOffset
Definition: nt_native.h:955
Definition: btrfs_drv.h:1876
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define TAG_KDBG
Definition: tag.h:38
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
uint32_t * PULONG
Definition: typedefs.h:59
#define NTAPI
Definition: typedefs.h:36
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
char * PCHAR
Definition: typedefs.h:51
#define STATUS_OBJECT_PATH_NOT_FOUND
Definition: udferr_usr.h:151
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
LONGLONG QuadPart
Definition: typedefs.h:114
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY _In_ WDF_INTERRUPT_PRIORITY Priority
Definition: wdfinterrupt.h:655
_In_ PWDFDEVICE_INIT _In_ PWDF_PDO_EVENT_CALLBACKS DispatchTable
Definition: wdfpdo.h:248
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFSPINLOCK * SpinLock
Definition: wdfsync.h:228
#define DbgKdGetContextApi
Definition: windbgkd.h:76
#define DbgKdLoadSymbolsStateChange
Definition: windbgkd.h:60
#define DbgKdPrintStringApi
Definition: windbgkd.h:122
#define DbgKdSetContextApi
Definition: windbgkd.h:77
#define PACKET_TYPE_KD_STATE_MANIPULATE
Definition: windbgkd.h:43
#define DbgKdGetStringApi
Definition: windbgkd.h:123
struct _DBGKD_ANY_WAIT_STATE_CHANGE * PDBGKD_ANY_WAIT_STATE_CHANGE
struct _DBGKD_MANIPULATE_STATE64 * PDBGKD_MANIPULATE_STATE64
#define DbgKdExceptionStateChange
Definition: windbgkd.h:59
#define PACKET_TYPE_KD_STATE_CHANGE64
Definition: windbgkd.h:48
#define DbgKdContinueApi
Definition: windbgkd.h:80
struct _DBGKD_DEBUG_IO * PDBGKD_DEBUG_IO
#define PACKET_TYPE_KD_DEBUG_IO
Definition: windbgkd.h:44
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define IO_NO_INCREMENT
Definition: iotypes.h:598
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:792
@ Executive
Definition: ketypes.h:403
char CHAR
Definition: xmlstorage.h:175