ReactOS  0.4.15-dev-2092-gf04890c
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)
24 static volatile ULONG KdpCurrentPosition = 0;
25 static volatile ULONG KdpFreeBytes = 0;
29 ANSI_STRING KdpLogFileName = RTL_CONSTANT_STRING("\\SystemRoot\\debug.log");
31 
35 
36 #define KdpScreenLineLengthDefault 80
39 
40 const ULONG KdpDmesgBufferSize = 128 * 1024; // 512*1024; // 5*1024*1024;
43 volatile ULONG KdpDmesgFreeBytes = 0;
47 
48 KDP_DEBUG_MODE KdpDebugMode;
50 KD_DISPATCH_TABLE DispatchTable[KdMax];
51 
52 PKDP_INIT_ROUTINE InitRoutines[KdMax] = {KdpScreenInit,
55  KdpKdbgInit};
56 
62 
63 /* LOCKING FUNCTIONS *********************************************************/
64 
65 KIRQL
66 NTAPI
68 {
69  KIRQL OldIrql;
70 
71  /* Acquire the spinlock without waiting at raised IRQL */
72  while (TRUE)
73  {
74  /* Loop until the spinlock becomes available */
75  while (!KeTestSpinLock(SpinLock));
76 
77  /* Spinlock is free, raise IRQL to high level */
79 
80  /* Try to get the spinlock */
82  break;
83 
84  /* Someone else got the spinlock, lower IRQL back */
86  }
87 
88  return OldIrql;
89 }
90 
91 VOID
92 NTAPI
95 {
96  /* Release the spinlock */
98  // KeReleaseSpinLockFromDpcLevel(SpinLock);
99 
100  /* Restore the old IRQL */
102 }
103 
104 /* FILE DEBUG LOG FUNCTIONS **************************************************/
105 
106 static VOID
107 NTAPI
109 {
110  ULONG beg, end, num;
112 
114 
115  while (TRUE)
116  {
118 
119  /* Bug */
120  /* Keep KdpCurrentPosition and KdpFreeBytes values in local
121  * variables to avoid their possible change from Producer part,
122  * KdpPrintToLogFile function
123  */
125  num = KdpFreeBytes;
126 
127  /* Now securely calculate values, based on local variables */
128  beg = (end + num) % KdpBufferSize;
129  num = KdpBufferSize - num;
130 
131  /* Nothing to do? */
132  if (num == 0)
133  continue;
134 
135  if (end > beg)
136  {
138  KdpDebugBuffer + beg, num, NULL, NULL);
139  }
140  else
141  {
143  KdpDebugBuffer + beg, KdpBufferSize - beg, NULL, NULL);
144 
147  }
148 
150  }
151 }
152 
153 static VOID
154 NTAPI
156  ULONG StringLength)
157 {
158  KIRQL OldIrql;
159  ULONG beg, end, num;
160  BOOLEAN DoReinit = FALSE;
161 
162  if (KdpDebugBuffer == NULL) return;
163 
164  /* Acquire the printing spinlock without waiting at raised IRQL */
166 
167  beg = KdpCurrentPosition;
168  num = KdpFreeBytes;
169  if (StringLength < num)
170  num = StringLength;
171 
172  if (num != 0)
173  {
174  end = (beg + num) % KdpBufferSize;
176  KdpFreeBytes -= num;
177 
178  if (end > beg)
179  {
181  }
182  else
183  {
186  }
187  }
188 
189  /* Release the spinlock */
191  {
192  DoReinit = TRUE;
193  }
195 
196  if (DoReinit)
197  {
199  KdpDebugLogInit(NULL, 3);
200  }
201 
202  /* Signal the logger thread */
205 }
206 
207 VOID
208 NTAPI
209 KdpDebugLogInit(PKD_DISPATCH_TABLE DispatchTable,
210  ULONG BootPhase)
211 {
216  HANDLE ThreadHandle;
218 
219  if (!KdpDebugMode.File) return;
220 
221  if (BootPhase == 0)
222  {
224 
225  /* Write out the functions that we support for now */
226  DispatchTable->KdpInitRoutine = KdpDebugLogInit;
227  DispatchTable->KdpPrintRoutine = KdpPrintToLogFile;
228 
229  /* Register as a Provider */
230  InsertTailList(&KdProviders, &DispatchTable->KdProvidersList);
231  }
232  else if (BootPhase == 1)
233  {
234  /* Allocate a buffer for debug log */
237 
238  /* Initialize spinlock */
240 
241  HalDisplayString("\r\n File log debugging enabled\r\n\r\n");
242  }
243  else if (BootPhase == 3)
244  {
245  /* Setup the log name */
247  if (!NT_SUCCESS(Status)) return;
248 
250  &FileName,
252  NULL,
253  NULL);
254 
255  /* Create the log file */
259  &Iosb,
260  NULL,
265  NULL,
266  0);
267 
269 
270  if (!NT_SUCCESS(Status))
271  return;
272 
274 
275  /* Create the logger thread */
276  Status = PsCreateSystemThread(&ThreadHandle,
278  NULL,
279  NULL,
280  NULL,
282  NULL);
283  if (!NT_SUCCESS(Status))
284  {
286  return;
287  }
288 
289  Priority = 7;
290  NtSetInformationThread(ThreadHandle,
292  &Priority,
293  sizeof(Priority));
294  }
295 }
296 
297 /* SERIAL FUNCTIONS **********************************************************/
298 
299 VOID
300 NTAPI
302  ULONG Length)
303 {
304  PCHAR pch = (PCHAR)Message;
305  KIRQL OldIrql;
306 
307  /* Acquire the printing spinlock without waiting at raised IRQL */
309 
310  /* Output the message */
311  while (pch < Message + Length && *pch != '\0')
312  {
313  if (*pch == '\n')
314  {
316  }
318  pch++;
319  }
320 
321  /* Release the spinlock */
323 }
324 
325 VOID
326 NTAPI
327 KdpSerialInit(PKD_DISPATCH_TABLE DispatchTable,
328  ULONG BootPhase)
329 {
330  if (!KdpDebugMode.Serial) return;
331 
332  if (BootPhase == 0)
333  {
334  /* Write out the functions that we support for now */
335  DispatchTable->KdpInitRoutine = KdpSerialInit;
336  DispatchTable->KdpPrintRoutine = KdpSerialDebugPrint;
337 
338  /* Initialize the Port */
340  {
341  KdpDebugMode.Serial = FALSE;
342  return;
343  }
345 
346  /* Initialize spinlock */
348 
349  /* Register as a Provider */
350  InsertTailList(&KdProviders, &DispatchTable->KdProvidersList);
351  }
352  else if (BootPhase == 1)
353  {
354  HalDisplayString("\r\n Serial debugging enabled\r\n\r\n");
355  }
356 }
357 
358 /* SCREEN FUNCTIONS **********************************************************/
359 
360 VOID
362 {
363  if (InbvIsBootDriverInstalled() /* &&
364  !InbvCheckDisplayOwnership() */)
365  {
366  /* Acquire ownership and reset the display */
374  }
375 }
376 
377 // extern VOID NTAPI InbvSetDisplayOwnership(IN BOOLEAN DisplayOwned);
378 
379 VOID
381 {
384  {
385  /* Release the display */
386  // InbvSetDisplayOwnership(FALSE);
388  }
389 }
390 
391 /*
392  * Screen debug logger function KdpScreenPrint() writes text messages into
393  * KdpDmesgBuffer, using it as a circular buffer. KdpDmesgBuffer contents could
394  * be later (re)viewed using dmesg command of kdbg. KdpScreenPrint() protects
395  * KdpDmesgBuffer from simultaneous writes by use of KdpDmesgLogSpinLock.
396  */
397 static VOID
398 NTAPI
400  ULONG Length)
401 {
402  PCHAR pch = (PCHAR)Message;
403  KIRQL OldIrql;
404  ULONG beg, end, num;
405 
406  while (pch < Message + Length && *pch)
407  {
408  if (*pch == '\b')
409  {
410  /* HalDisplayString does not support '\b'. Workaround it and use '\r' */
411  if (KdpScreenLineLength > 0)
412  {
413  /* Remove last character from buffer */
416 
417  /* Clear row and print line again */
418  HalDisplayString("\r");
420  }
421  }
422  else
423  {
426  }
427 
429  {
430  /* Print buffered characters */
433 
434  /* Clear line buffer */
435  KdpScreenLineBuffer[0] = '\0';
437  }
438 
439  ++pch;
440  }
441 
442  /* Print buffered characters */
444  {
447  }
448 
449  /* Dmesg: store Message in the buffer to show it later */
450  if (KdbpIsInDmesgMode)
451  return;
452 
453  if (KdpDmesgBuffer == NULL)
454  return;
455 
456  /* Acquire the printing spinlock without waiting at raised IRQL */
458 
459  /* Invariant: always_true(KdpDmesgFreeBytes == KdpDmesgBufferSize);
460  * set num to min(KdpDmesgFreeBytes, Length).
461  */
464  if (num != 0)
465  {
466  end = (beg + num) % KdpDmesgBufferSize;
467  if (end > beg)
468  {
470  }
471  else
472  {
475  }
477 
478  /* Counting the total bytes written */
480  }
481 
482  /* Release the spinlock */
484 
485  /* Optional step(?): find out a way to notify about buffer exhaustion,
486  * and possibly fall into kbd to use dmesg command: user will read
487  * debug messages before they will be wiped over by next writes.
488  */
489 }
490 
491 VOID
492 NTAPI
493 KdpScreenInit(PKD_DISPATCH_TABLE DispatchTable,
494  ULONG BootPhase)
495 {
496  if (!KdpDebugMode.Screen) return;
497 
498  if (BootPhase == 0)
499  {
500  /* Write out the functions that we support for now */
501  DispatchTable->KdpInitRoutine = KdpScreenInit;
502  DispatchTable->KdpPrintRoutine = KdpScreenPrint;
503 
504  /* Register as a Provider */
505  InsertTailList(&KdProviders, &DispatchTable->KdProvidersList);
506  }
507  else if (BootPhase == 1)
508  {
509  /* Allocate a buffer for dmesg log buffer. +1 for terminating null,
510  * see kdbp_cli.c:KdbpCmdDmesg()/2
511  */
516 
517  /* Take control of the display */
519 
520  /* Initialize spinlock */
522 
523  HalDisplayString("\r\n Screen debugging enabled\r\n\r\n");
524  }
525 }
526 
527 /* GENERAL FUNCTIONS *********************************************************/
528 
529 BOOLEAN
530 NTAPI
533 
534 extern STRING KdbPromptString;
535 
536 VOID
537 NTAPI
539  IN ULONG PacketType,
540  IN PSTRING MessageHeader,
541  IN PSTRING MessageData,
543 {
544  if (PacketType == PACKET_TYPE_KD_DEBUG_IO)
545  {
546  PSTRING Output = MessageData;
547  PLIST_ENTRY CurrentEntry;
548  PKD_DISPATCH_TABLE CurrentTable;
549 
550  if (!KdpDebugMode.Value) return;
551 
552  /* Call the registered handlers */
553  CurrentEntry = KdProviders.Flink;
554  while (CurrentEntry != &KdProviders)
555  {
556  /* Get the current table */
557  CurrentTable = CONTAINING_RECORD(CurrentEntry,
558  KD_DISPATCH_TABLE,
559  KdProvidersList);
560 
561  /* Call it */
562  CurrentTable->KdpPrintRoutine(Output->Buffer, Output->Length);
563 
564  /* Next Table */
565  CurrentEntry = CurrentEntry->Flink;
566  }
567  return;
568  }
569  else if (PacketType == PACKET_TYPE_KD_STATE_CHANGE64)
570  {
571  PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange = (PDBGKD_ANY_WAIT_STATE_CHANGE)MessageHeader->Buffer;
572  if (WaitStateChange->NewState == DbgKdLoadSymbolsStateChange)
573  {
574 #ifdef KDBG
575  PLDR_DATA_TABLE_ENTRY LdrEntry;
576  if (!WaitStateChange->u.LoadSymbols.UnloadSymbols)
577  {
578  /* Load symbols. Currently implemented only for KDBG! */
579  if (KdbpSymFindModule((PVOID)(ULONG_PTR)WaitStateChange->u.LoadSymbols.BaseOfDll, NULL, -1, &LdrEntry))
580  {
581  KdbSymProcessSymbols(LdrEntry);
582  }
583  }
584 #endif
585  return;
586  }
587  else if (WaitStateChange->NewState == DbgKdExceptionStateChange)
588  {
590  KdbgExceptionRecord = WaitStateChange->u.Exception.ExceptionRecord;
591  KdbgFirstChanceException = WaitStateChange->u.Exception.FirstChance;
592  return;
593  }
594  }
595  else if (PacketType == PACKET_TYPE_KD_STATE_MANIPULATE)
596  {
597  PDBGKD_MANIPULATE_STATE64 ManipulateState = (PDBGKD_MANIPULATE_STATE64)MessageHeader->Buffer;
598  if (ManipulateState->ApiNumber == DbgKdGetContextApi)
599  {
600  KD_CONTINUE_TYPE Result;
601 
602 #ifdef KDBG
603  /* Check if this is an assertion failure */
605  {
606  /* Bump EIP to the instruction following the int 2C */
607  KdbgContext.Eip += 2;
608  }
609 
611  KdbgContext.SegCs & 1,
612  &KdbgContext,
614 #else
615  /* We'll manually dump the stack for the user... */
617  Result = kdHandleException;
618 #endif
619  if (Result != kdHandleException)
621  else
624  return;
625  }
626  else if (ManipulateState->ApiNumber == DbgKdSetContextApi)
627  {
629  return;
630  }
631  }
633 }
634 
635 KDSTATUS
636 NTAPI
638  IN ULONG PacketType,
639  OUT PSTRING MessageHeader,
640  OUT PSTRING MessageData,
643 {
644 #ifdef KDBG
645  KIRQL OldIrql;
646  STRING StringChar;
647  CHAR Response;
648  USHORT i;
649  ULONG DummyScanCode;
650  CHAR MessageBuffer[100];
651  STRING ResponseString;
652 #endif
653 
654  if (PacketType == PACKET_TYPE_KD_STATE_MANIPULATE)
655  {
656  PDBGKD_MANIPULATE_STATE64 ManipulateState = (PDBGKD_MANIPULATE_STATE64)MessageHeader->Buffer;
657  RtlZeroMemory(MessageHeader->Buffer, MessageHeader->MaximumLength);
659  {
660  ManipulateState->ApiNumber = DbgKdGetContextApi;
661  MessageData->Length = 0;
662  MessageData->Buffer = (PCHAR)&KdbgContext;
663  return KdPacketReceived;
664  }
666  {
667  ManipulateState->ApiNumber = DbgKdSetContextApi;
668  MessageData->Length = sizeof(KdbgContext);
669  MessageData->Buffer = (PCHAR)&KdbgContext;
670  return KdPacketReceived;
671  }
673  {
675  }
676  ManipulateState->ApiNumber = DbgKdContinueApi;
677  ManipulateState->u.Continue.ContinueStatus = KdbgContinueStatus;
678 
679  /* Prepare for next time */
682 
683  return KdPacketReceived;
684  }
685 
686  if (PacketType != PACKET_TYPE_KD_DEBUG_IO)
687  return KdPacketTimedOut;
688 
689 #ifdef KDBG
690  ResponseString.Buffer = MessageBuffer;
691  ResponseString.Length = 0;
692  ResponseString.MaximumLength = min(sizeof(MessageBuffer), MessageData->MaximumLength);
693  StringChar.Buffer = &Response;
694  StringChar.Length = StringChar.MaximumLength = sizeof(Response);
695 
696  /* Display the string and print a new line for log neatness */
697  *StringChar.Buffer = '\n';
698  KdpPrintString(&StringChar);
699 
700  /* Print the kdb prompt */
702 
703  // TODO: Use an improved KdbpReadCommand() function for our purposes.
704 
705  /* Acquire the printing spinlock without waiting at raised IRQL */
707 
709  KbdDisableMouse();
710 
711  /* Loop the whole string */
712  for (i = 0; i < ResponseString.MaximumLength; i++)
713  {
714  /* Check if this is serial debugging mode */
716  {
717  /* Get the character from serial */
718  do
719  {
721  } while (Response == -1);
722  }
723  else
724  {
725  /* Get the response from the keyboard */
726  do
727  {
728  Response = KdbpTryGetCharKeyboard(&DummyScanCode, MAXULONG);
729  } while (Response == -1);
730  }
731 
732  /* Check for return */
733  if (Response == '\r')
734  {
735  /*
736  * We might need to discard the next '\n'.
737  * Wait a bit to make sure we receive it.
738  */
740 
741  /* Check the mode */
743  {
744  /* Read and discard the next character, if any */
746  }
747  else
748  {
749  /* Read and discard the next character, if any */
750  KdbpTryGetCharKeyboard(&DummyScanCode, 5);
751  }
752 
753  /*
754  * Null terminate the output string -- documentation states that
755  * DbgPrompt does not null terminate, but it does
756  */
757  *(PCHAR)(ResponseString.Buffer + i) = 0;
758  break;
759  }
760 
761  /* Write it back and print it to the log */
762  *(PCHAR)(ResponseString.Buffer + i) = Response;
764  KdpPrintString(&StringChar);
766  }
767 
768  /* Print a new line */
769  *StringChar.Buffer = '\n';
770  KdpPrintString(&StringChar);
771 
772  /* Return the length */
773  RtlCopyMemory(MessageData->Buffer, ResponseString.Buffer, i);
774  *DataLength = i;
775 
777  KbdEnableMouse();
778 
779  /* Release the spinlock */
781 
782 #endif
783  return KdPacketReceived;
784 }
785 
786 /* EOF */
signed char * PCHAR
Definition: retypes.h:7
static BOOLEAN KdpLoggingEnabled
Definition: kdio.c:21
static CHAR KdpScreenLineBuffer[KdpScreenLineLengthDefault+1]
Definition: kdio.c:37
#define KdPacketReceived
Definition: kddll.h:5
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
VOID NTAPI InbvNotifyDisplayOwnershipLost(IN INBV_RESET_DISPLAY_PARAMETERS Callback)
Definition: inbv.c:638
#define KeRosDumpStackFrames(Frames, Count)
Definition: gdidebug.h:11
#define IN
Definition: typedefs.h:39
struct _DBGKD_ANY_WAIT_STATE_CHANGE * PDBGKD_ANY_WAIT_STATE_CHANGE
DBGKD_CONTINUE Continue
Definition: windbgkd.h:779
#define THREAD_ALL_ACCESS
Definition: nt_native.h:1339
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
static HANDLE KdpLogFileHandle
Definition: kdio.c:28
VOID NTAPI KdpKdbgInit(PKD_DISPATCH_TABLE DispatchTable, ULONG BootPhase)
Definition: kdbg.c:21
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
volatile ULONG KdpDmesgCurrentPosition
Definition: kdio.c:42
ULONG Eip
Definition: nt_native.h:1476
union _DBGKD_MANIPULATE_STATE64::@3507 u
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static volatile ULONG KdpFreeBytes
Definition: kdio.c:25
PCHAR KdpDmesgBuffer
Definition: kdio.c:41
ULONG KdbDebugState
Definition: kdb.c:45
VOID KdbSymProcessSymbols(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: kdb_symbols.c:434
#define TRUE
Definition: types.h:120
char CHAR
Definition: xmlstorage.h:175
static ULONG KdpScreenLineLength
Definition: kdio.c:38
static ULONG KdbgNextApiNumber
Definition: kdio.c:57
LONG NTSTATUS
Definition: precomp.h:26
#define SCREEN_WIDTH
Definition: pc98video.c:27
static KSPIN_LOCK KdpDmesgLogSpinLock
Definition: kdio.c:46
NTSTATUS ExceptionCode
Definition: rtltypes.h:190
VOID NTAPI KdpSerialInit(PKD_DISPATCH_TABLE DispatchTable, ULONG BootPhase)
Definition: kdio.c:327
VOID NTAPI InbvSolidColorFill(IN ULONG Left, IN ULONG Top, IN ULONG Right, IN ULONG Bottom, IN ULONG Color)
Definition: inbv.c:716
KIRQL NTAPI KdpAcquireLock(IN PKSPIN_LOCK SpinLock)
Definition: kdio.c:67
#define BV_COLOR_WHITE
Definition: display.h:30
KSPIN_LOCK * PKSPIN_LOCK
Definition: env_spec_w32.h:73
#define DbgKdExceptionStateChange
Definition: windbgkd.h:59
#define InsertTailList(ListHead, Entry)
#define DbgKdContinueApi
Definition: windbgkd.h:80
#define FILE_APPEND_DATA
Definition: nt_native.h:634
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
ULONG ExpInitializationPhase
Definition: init.c:66
LONG KPRIORITY
Definition: compat.h:662
#define pch(ap)
Definition: match.c:418
static KEVENT KdpLoggerThreadEvent
Definition: kdio.c:27
CHAR KdbpTryGetCharSerial(ULONG Retry)
Definition: kdb_serial.c:19
#define FILE_SHARE_READ
Definition: compat.h:136
CHAR KdbpTryGetCharKeyboard(PULONG ScanCode, ULONG Retry)
Definition: kdb_keyboard.c:104
uint32_t ULONG_PTR
Definition: typedefs.h:65
static KSPIN_LOCK KdpDebugLogSpinLock
Definition: kdio.c:26
KDP_DEBUG_MODE KdpDebugMode
Definition: kdio.c:48
static VOID NTAPI KdpPrintToLogFile(PCHAR String, ULONG StringLength)
Definition: kdio.c:155
static VOID NTAPI KdpScreenPrint(PCHAR Message, ULONG Length)
Definition: kdio.c:399
BOOLEAN NTAPI KdPortInitializeEx(PCPPORT PortInformation, ULONG ComPortNumber)
UCHAR KIRQL
Definition: env_spec_w32.h:591
_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
#define FALSE
Definition: types.h:117
VOID NTAPI KdpScreenInit(PKD_DISPATCH_TABLE DispatchTable, ULONG BootPhase)
Definition: kdio.c:493
STRING KdbPromptString
Definition: kdb_cli.c:143
VOID FASTCALL KiReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: ntoskrnl.c:35
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFSPINLOCK * SpinLock
Definition: wdfsync.h:225
#define DEFAULT_DEBUG_PORT
Definition: kdcom.c:25
VOID KdpScreenRelease(VOID)
Definition: kdio.c:380
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:238
DBGKD_LOAD_SYMBOLS64 LoadSymbols
Definition: windbgkd.h:489
#define FILE_WRITE_THROUGH
Definition: from_kernel.h:26
ULONG SegCs
Definition: nt_native.h:1477
unsigned char BOOLEAN
static NTSTATUS KdbgContinueStatus
Definition: kdio.c:61
_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
VOID KbdEnableMouse(VOID)
ANSI_STRING KdpLogFileName
Definition: kdio.c:29
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
Definition: cdrom.h:1437
volatile ULONG KdbDmesgTotalWritten
Definition: kdio.c:44
VOID NTAPI KdPortPutByteEx(PCPPORT PortInformation, UCHAR ByteToSend)
NTSTATUS NTAPI NtSetInformationThread(IN HANDLE ThreadHandle, IN THREADINFOCLASS ThreadInformationClass, IN PVOID ThreadInformation, IN ULONG ThreadInformationLength)
Definition: query.c:2018
static VOID NTAPI KdpLoggerThread(PVOID Context)
Definition: kdio.c:108
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
VOID NTAPI InbvSetTextColor(IN ULONG Color)
Definition: inbv.c:692
VOID KdpScreenAcquire(VOID)
Definition: kdio.c:361
#define PCHAR
Definition: match.c:90
BOOLEAN FASTCALL KeTestSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:442
Status
Definition: gdiplustypes.h:24
#define SCREEN_HEIGHT
Definition: pc98video.c:28
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
static volatile ULONG KdpCurrentPosition
Definition: kdio.c:24
#define STATUS_ASSERTION_FAILURE
Definition: ntstatus.h:960
#define DEFAULT_DEBUG_BAUD_RATE
Definition: kdcom.c:28
PUCHAR KdComPortInUse
Definition: usage.c:17
NTSTATUS NTAPI NtCreateFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER AllocationSize OPTIONAL, IN ULONG FileAttributes, IN ULONG ShareAccess, IN ULONG CreateDisposition, IN ULONG CreateOptions, IN PVOID EaBuffer OPTIONAL, IN ULONG EaLength)
#define KdPacketTimedOut
Definition: kddll.h:6
#define DbgKdLoadSymbolsStateChange
Definition: windbgkd.h:60
if(!(yy_init))
Definition: macro.lex.yy.c:714
return Iosb
Definition: create.c:4402
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define InterlockedExchangeAddUL(Addend, Value)
Definition: ex.h:1505
#define DbgKdGetContextApi
Definition: windbgkd.h:76
VOID KbdDisableMouse(VOID)
VOID NTAPI KdpReleaseLock(IN PKSPIN_LOCK SpinLock, IN KIRQL OldIrql)
Definition: kdio.c:93
GLuint GLuint num
Definition: glext.h:9618
#define KdpBufferSize
Definition: kdio.c:20
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define KdpScreenLineLengthDefault
Definition: kdio.c:36
static BOOLEAN KdpLoggingStarting
Definition: kdio.c:22
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
Definition: ncftp.h:89
static PCHAR KdpDebugBuffer
Definition: kdio.c:23
GLuint GLuint end
Definition: gl.h:1545
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
CHAR Message[80]
Definition: alive.c:5
std::wstring STRING
Definition: fontsub.cpp:33
#define PACKET_TYPE_KD_STATE_MANIPULATE
Definition: windbgkd.h:43
VOID NTAPI InbvAcquireDisplayOwnership(VOID)
Definition: inbv.c:528
EXCEPTION_RECORD64 ExceptionRecord
Definition: windbgkd.h:303
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY _In_ WDF_INTERRUPT_PRIORITY Priority
Definition: wdfinterrupt.h:651
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define PACKET_TYPE_KD_STATE_CHANGE64
Definition: windbgkd.h:48
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
static BOOLEAN KdbgFirstChanceException
Definition: kdio.c:60
Definition: arc.h:85
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
#define VOID
Definition: acefi.h:82
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)
Definition: btrfs_drv.h:1922
VOID NTAPI KdpSerialDebugPrint(PCHAR Message, ULONG Length)
Definition: kdio.c:301
#define DbgKdSetContextApi
Definition: windbgkd.h:77
volatile ULONG KdpDmesgFreeBytes
Definition: kdio.c:43
Definition: typedefs.h:119
KDSTATUS NTAPI KdReceivePacket(IN ULONG PacketType, OUT PSTRING MessageHeader, OUT PSTRING MessageData, OUT PULONG DataLength, IN OUT PKD_CONTEXT Context)
Definition: kdio.c:637
#define SYNCHRONIZE
Definition: nt_native.h:61
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
const ULONG KdpDmesgBufferSize
Definition: kdio.c:40
PUCHAR Address
Definition: cportlib.h:29
#define MAXULONG
Definition: typedefs.h:251
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
BOOLEAN NTAPI InbvEnableDisplayString(IN BOOLEAN Enable)
Definition: inbv.c:606
#define _In_
Definition: no_sal2.h:158
BOOLEAN NTAPI InbvIsBootDriverInstalled(VOID)
Definition: inbv.c:630
#define HIGH_LEVEL
Definition: env_spec_w32.h:703
struct _FileName FileName
Definition: fatprocs.h:893
BOOLEAN NTAPI KdpPrintString(_In_ PSTRING Output)
Definition: kdprint.c:22
BOOLEAN NTAPI InbvResetDisplay(VOID)
Definition: inbv.c:664
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned short USHORT
Definition: pedump.c:61
static EXCEPTION_RECORD64 KdbgExceptionRecord
Definition: kdio.c:59
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
PKDP_INIT_ROUTINE InitRoutines[KdMax]
Definition: kdio.c:52
#define PACKET_TYPE_KD_DEBUG_IO
Definition: windbgkd.h:44
static KSPIN_LOCK KdpSerialSpinLock
Definition: kdio.c:32
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
ULONG KDSTATUS
Definition: kddll.h:4
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
struct _DBGKD_MANIPULATE_STATE64 * PDBGKD_MANIPULATE_STATE64
NTSTATUS ContinueStatus
Definition: windbgkd.h:559
unsigned int * PULONG
Definition: retypes.h:1
#define min(a, b)
Definition: monoChain.cc:55
static CONTEXT KdbgContext
Definition: kdio.c:58
CPPORT SerialPortInfo
Definition: kdio.c:34
#define NULL
Definition: types.h:112
NTHALAPI VOID NTAPI HalDisplayString(PUCHAR String)
DBGKM_EXCEPTION64 Exception
Definition: windbgkd.h:488
VOID NTAPI InbvInstallDisplayStringFilter(IN INBV_DISPLAY_STRING_FILTER Filter)
Definition: inbv.c:622
#define BV_COLOR_BLACK
Definition: display.h:15
ULONG SerialPortNumber
Definition: kdio.c:33
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
VOID NTAPI KdSendPacket(IN ULONG PacketType, IN PSTRING MessageHeader, IN PSTRING MessageData, IN OUT PKD_CONTEXT Context)
Definition: kdio.c:538
static ULONG KdpScreenLineBufferPos
Definition: kdio.c:38
#define OUT
Definition: typedefs.h:40
volatile BOOLEAN KdbpIsInDmesgMode
Definition: kdio.c:45
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define FILE_SUPERSEDE
Definition: from_kernel.h:53
#define UNIMPLEMENTED
Definition: debug.h:115
struct Response Response
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_SUCCESS
Definition: shellext.h:65
VOID NTAPI KdpDebugLogInit(PKD_DISPATCH_TABLE DispatchTable, ULONG BootPhase)
Definition: kdio.c:209
BOOLEAN NTAPI InbvCheckDisplayOwnership(VOID)
Definition: inbv.c:553
VOID NTAPI InbvSetScrollRegion(IN ULONG Left, IN ULONG Top, IN ULONG Right, IN ULONG Bottom)
Definition: inbv.c:681
BOOLEAN FASTCALL KeTryToAcquireSpinLockAtDpcLevel(IN OUT PKSPIN_LOCK SpinLock)
Definition: spinlock.c:303
_In_ PWDFDEVICE_INIT _In_ PWDF_PDO_EVENT_CALLBACKS DispatchTable
Definition: wdfpdo.h:245
union _DBGKD_ANY_WAIT_STATE_CHANGE::@3499 u
VOID NTAPI KeStallExecutionProcessor(IN ULONG MicroSeconds)
Definition: ntoskrnl.c:95
BOOLEAN KdbpSymFindModule(IN PVOID Address OPTIONAL, IN LPCWSTR Name OPTIONAL, IN INT Index OPTIONAL, OUT PLDR_DATA_TABLE_ENTRY *pLdrEntry)
Find a module...
Definition: kdb_symbols.c:84
LIST_ENTRY KdProviders
Definition: kdio.c:49
KD_CONTINUE_TYPE KdbEnterDebuggerException(IN PEXCEPTION_RECORD64 ExceptionRecord, IN KPROCESSOR_MODE PreviousMode, IN PCONTEXT Context, IN BOOLEAN FirstChance)
KDB Exception filter.
Definition: kdb.c:1258
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14