ReactOS  0.4.14-dev-614-gbfd8a84
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 #define NDEBUG
15 #include <debug.h>
16 
17 /* GLOBALS *******************************************************************/
18 
19 #define KdpBufferSize (1024 * 512)
22 static volatile ULONG KdpCurrentPosition = 0;
23 static volatile ULONG KdpFreeBytes = 0;
27 ANSI_STRING KdpLogFileName = RTL_CONSTANT_STRING("\\SystemRoot\\debug.log");
28 
32 
33 /* Current Port in use. FIXME: Do we support more than one? */
35 
36 #define KdpScreenLineLengthDefault 80
39 
40 const ULONG KdpDmesgBufferSize = 128 * 1024; // 512*1024; // 5*1024*1024;
43 volatile ULONG KdpDmesgFreeBytes = 0;
47 
48 /* UTILITY FUNCTIONS *********************************************************/
49 
50 /*
51  * Get the total size of the memory before
52  * Mm is initialized, by counting the number
53  * of physical pages. Useful for debug logging.
54  *
55  * Strongly inspired by:
56  * mm\ARM3\mminit.c : MiScanMemoryDescriptors(...)
57  *
58  * See also: kd64\kdinit.c
59  */
60 static INIT_FUNCTION
61 SIZE_T
63 {
64  PLIST_ENTRY ListEntry;
66  SIZE_T NumberOfPhysicalPages = 0;
67 
68  /* Loop the memory descriptors */
69  for (ListEntry = LoaderBlock->MemoryDescriptorListHead.Flink;
70  ListEntry != &LoaderBlock->MemoryDescriptorListHead;
71  ListEntry = ListEntry->Flink)
72  {
73  /* Get the descriptor */
74  Descriptor = CONTAINING_RECORD(ListEntry,
76  ListEntry);
77 
78  /* Check if this is invisible memory */
79  if ((Descriptor->MemoryType == LoaderFirmwarePermanent) ||
80  (Descriptor->MemoryType == LoaderSpecialMemory) ||
81  (Descriptor->MemoryType == LoaderHALCachedMemory) ||
82  (Descriptor->MemoryType == LoaderBBTMemory))
83  {
84  /* Skip this descriptor */
85  continue;
86  }
87 
88  /* Check if this is bad memory */
89  if (Descriptor->MemoryType != LoaderBad)
90  {
91  /* Count this in the total of pages */
92  NumberOfPhysicalPages += Descriptor->PageCount;
93  }
94  }
95 
96  /* Round size up. Assumed to better match actual physical RAM size */
97  return ALIGN_UP_BY(NumberOfPhysicalPages * PAGE_SIZE, 1024 * 1024) / (1024 * 1024);
98 }
99 
100 /* See also: kd64\kdinit.c */
101 static INIT_FUNCTION
102 VOID
104 {
105  DPRINT1("-----------------------------------------------------\n");
106  DPRINT1("ReactOS " KERNEL_VERSION_STR " (Build " KERNEL_VERSION_BUILD_STR ") (Commit " KERNEL_VERSION_COMMIT_HASH ")\n");
107  DPRINT1("%u System Processor [%u MB Memory]\n", KeNumberProcessors, MemSizeMBs);
108  DPRINT1("Command Line: %s\n", KeLoaderBlock->LoadOptions);
110 }
111 
112 /* LOCKING FUNCTIONS *********************************************************/
113 
114 KIRQL
115 NTAPI
117 {
118  KIRQL OldIrql;
119 
120  /* Acquire the spinlock without waiting at raised IRQL */
121  while (TRUE)
122  {
123  /* Loop until the spinlock becomes available */
124  while (!KeTestSpinLock(SpinLock));
125 
126  /* Spinlock is free, raise IRQL to high level */
128 
129  /* Try to get the spinlock */
131  break;
132 
133  /* Someone else got the spinlock, lower IRQL back */
135  }
136 
137  return OldIrql;
138 }
139 
140 VOID
141 NTAPI
143  IN KIRQL OldIrql)
144 {
145  /* Release the spinlock */
147  // KeReleaseSpinLockFromDpcLevel(SpinLock);
148 
149  /* Restore the old IRQL */
151 }
152 
153 /* FILE DEBUG LOG FUNCTIONS **************************************************/
154 
155 static VOID
156 NTAPI
158 {
159  ULONG beg, end, num;
161 
163 
164  while (TRUE)
165  {
167 
168  /* Bug */
169  /* Keep KdpCurrentPosition and KdpFreeBytes values in local
170  * variables to avoid their possible change from Producer part,
171  * KdpPrintToLogFile function
172  */
174  num = KdpFreeBytes;
175 
176  /* Now securely calculate values, based on local variables */
177  beg = (end + num) % KdpBufferSize;
178  num = KdpBufferSize - num;
179 
180  /* Nothing to do? */
181  if (num == 0)
182  continue;
183 
184  if (end > beg)
185  {
187  KdpDebugBuffer + beg, num, NULL, NULL);
188  }
189  else
190  {
192  KdpDebugBuffer + beg, KdpBufferSize - beg, NULL, NULL);
193 
196  }
197 
199  }
200 }
201 
202 static VOID
203 NTAPI
205  ULONG StringLength)
206 {
207  KIRQL OldIrql;
208  ULONG beg, end, num;
209 
210  if (KdpDebugBuffer == NULL) return;
211 
212  /* Acquire the printing spinlock without waiting at raised IRQL */
214 
215  beg = KdpCurrentPosition;
216  num = KdpFreeBytes;
217  if (StringLength < num)
218  num = StringLength;
219 
220  if (num != 0)
221  {
222  end = (beg + num) % KdpBufferSize;
224  KdpFreeBytes -= num;
225 
226  if (end > beg)
227  {
229  }
230  else
231  {
234  }
235  }
236 
237  /* Release the spinlock */
239 
240  /* Signal the logger thread */
243 }
244 
245 VOID
246 NTAPI
247 KdpDebugLogInit(PKD_DISPATCH_TABLE DispatchTable,
248  ULONG BootPhase)
249 {
254  HANDLE ThreadHandle;
256  SIZE_T MemSizeMBs;
257 
258  if (!KdpDebugMode.File) return;
259 
260  if (BootPhase == 0)
261  {
263 
264  /* Write out the functions that we support for now */
265  DispatchTable->KdpInitRoutine = KdpDebugLogInit;
266  DispatchTable->KdpPrintRoutine = KdpPrintToLogFile;
267 
268  /* Register as a Provider */
269  InsertTailList(&KdProviders, &DispatchTable->KdProvidersList);
270  }
271  else if (BootPhase == 1)
272  {
273  /* Allocate a buffer for debug log */
276 
277  /* Initialize spinlock */
279 
280  /* Display separator + ReactOS version at start of the debug log */
281  /* Round size up. Assumed to better match actual physical RAM size */
282  MemSizeMBs = ALIGN_UP_BY(MmNumberOfPhysicalPages * PAGE_SIZE, 1024 * 1024) / (1024 * 1024);
283  KdpPrintBanner(MemSizeMBs);
284  }
285  else if (BootPhase == 2)
286  {
287  HalDisplayString("\r\n File log debugging enabled\r\n\r\n");
288  }
289  else if (BootPhase == 3)
290  {
291  /* Setup the log name */
293  if (!NT_SUCCESS(Status)) return;
294 
296  &FileName,
298  NULL,
299  NULL);
300 
301  /* Create the log file */
305  &Iosb,
306  NULL,
311  NULL,
312  0);
313 
315 
316  if (!NT_SUCCESS(Status))
317  return;
318 
320 
321  /* Create the logger thread */
322  Status = PsCreateSystemThread(&ThreadHandle,
324  NULL,
325  NULL,
326  NULL,
328  NULL);
329  if (!NT_SUCCESS(Status))
330  {
332  return;
333  }
334 
335  Priority = 7;
336  NtSetInformationThread(ThreadHandle,
338  &Priority,
339  sizeof(Priority));
340  }
341 }
342 
343 /* SERIAL FUNCTIONS **********************************************************/
344 
345 VOID
346 NTAPI
348  ULONG Length)
349 {
350  PCHAR pch = (PCHAR)Message;
351  KIRQL OldIrql;
352 
353  /* Acquire the printing spinlock without waiting at raised IRQL */
355 
356  /* Output the message */
357  while (pch < Message + Length && *pch != '\0')
358  {
359  if (*pch == '\n')
360  {
362  }
364  pch++;
365  }
366 
367  /* Release the spinlock */
369 }
370 
371 VOID
372 NTAPI
373 KdpSerialInit(PKD_DISPATCH_TABLE DispatchTable,
374  ULONG BootPhase)
375 {
376  SIZE_T MemSizeMBs;
377  if (!KdpDebugMode.Serial) return;
378 
379  if (BootPhase == 0)
380  {
381  /* Write out the functions that we support for now */
382  DispatchTable->KdpInitRoutine = KdpSerialInit;
383  DispatchTable->KdpPrintRoutine = KdpSerialDebugPrint;
384 
385  /* Initialize the Port */
387  {
388  KdpDebugMode.Serial = FALSE;
389  return;
390  }
392 
393  /* Initialize spinlock */
395 
396  /* Register as a Provider */
397  InsertTailList(&KdProviders, &DispatchTable->KdProvidersList);
398 
399  /* Display separator + ReactOS version at start of the debug log */
400  MemSizeMBs = KdpGetMemorySizeInMBs(KeLoaderBlock);
401  KdpPrintBanner(MemSizeMBs);
402  }
403  else if (BootPhase == 2)
404  {
405  HalDisplayString("\r\n Serial debugging enabled\r\n\r\n");
406  }
407 }
408 
409 /* SCREEN FUNCTIONS **********************************************************/
410 
411 VOID
413 {
414  if (InbvIsBootDriverInstalled() /* &&
415  !InbvCheckDisplayOwnership() */)
416  {
417  /* Acquire ownership and reset the display */
420  InbvSolidColorFill(0, 0, 639, 479, 0);
421  InbvSetTextColor(15);
424  InbvSetScrollRegion(0, 0, 639, 479);
425  }
426 }
427 
428 // extern VOID NTAPI InbvSetDisplayOwnership(IN BOOLEAN DisplayOwned);
429 
430 VOID
432 {
435  {
436  /* Release the display */
437  // InbvSetDisplayOwnership(FALSE);
439  }
440 }
441 
442 /*
443  * Screen debug logger function KdpScreenPrint() writes text messages into
444  * KdpDmesgBuffer, using it as a circular buffer. KdpDmesgBuffer contents could
445  * be later (re)viewed using dmesg command of kdbg. KdpScreenPrint() protects
446  * KdpDmesgBuffer from simultaneous writes by use of KdpDmesgLogSpinLock.
447  */
448 static VOID
449 NTAPI
451  ULONG Length)
452 {
453  PCHAR pch = (PCHAR)Message;
454  KIRQL OldIrql;
455  ULONG beg, end, num;
456 
457  while (pch < Message + Length && *pch)
458  {
459  if (*pch == '\b')
460  {
461  /* HalDisplayString does not support '\b'. Workaround it and use '\r' */
462  if (KdpScreenLineLength > 0)
463  {
464  /* Remove last character from buffer */
467 
468  /* Clear row and print line again */
469  HalDisplayString("\r");
471  }
472  }
473  else
474  {
477  }
478 
480  {
481  /* Print buffered characters */
484 
485  /* Clear line buffer */
486  KdpScreenLineBuffer[0] = '\0';
488  }
489 
490  ++pch;
491  }
492 
493  /* Print buffered characters */
495  {
498  }
499 
500  /* Dmesg: store Message in the buffer to show it later */
501  if (KdbpIsInDmesgMode)
502  return;
503 
504  if (KdpDmesgBuffer == NULL)
505  return;
506 
507  /* Acquire the printing spinlock without waiting at raised IRQL */
509 
510  /* Invariant: always_true(KdpDmesgFreeBytes == KdpDmesgBufferSize);
511  * set num to min(KdpDmesgFreeBytes, Length).
512  */
515  if (num != 0)
516  {
517  end = (beg + num) % KdpDmesgBufferSize;
518  if (end > beg)
519  {
521  }
522  else
523  {
526  }
528 
529  /* Counting the total bytes written */
531  }
532 
533  /* Release the spinlock */
535 
536  /* Optional step(?): find out a way to notify about buffer exhaustion,
537  * and possibly fall into kbd to use dmesg command: user will read
538  * debug messages before they will be wiped over by next writes.
539  */
540 }
541 
542 VOID
543 NTAPI
544 KdpScreenInit(PKD_DISPATCH_TABLE DispatchTable,
545  ULONG BootPhase)
546 {
547  SIZE_T MemSizeMBs;
548  if (!KdpDebugMode.Screen) return;
549 
550  if (BootPhase == 0)
551  {
552  /* Write out the functions that we support for now */
553  DispatchTable->KdpInitRoutine = KdpScreenInit;
554  DispatchTable->KdpPrintRoutine = KdpScreenPrint;
555 
556  /* Register as a Provider */
557  InsertTailList(&KdProviders, &DispatchTable->KdProvidersList);
558  }
559  else if (BootPhase == 1)
560  {
561  /* Allocate a buffer for dmesg log buffer. +1 for terminating null,
562  * see kdbp_cli.c:KdbpCmdDmesg()/2
563  */
568 
569  /* Take control of the display */
571 
572  /* Initialize spinlock */
574 
575  /* Display separator + ReactOS version at start of the debug log */
576  /* Round size up. Assumed to better match actual physical RAM size */
577  MemSizeMBs = ALIGN_UP_BY(MmNumberOfPhysicalPages * PAGE_SIZE, 1024 * 1024) / (1024 * 1024);
578  KdpPrintBanner(MemSizeMBs);
579  }
580  else if (BootPhase == 2)
581  {
582  HalDisplayString("\r\n Screen debugging enabled\r\n\r\n");
583  }
584 }
585 
586 /* GENERAL FUNCTIONS *********************************************************/
587 
588 BOOLEAN
589 NTAPI
592 {
593  PLIST_ENTRY CurrentEntry;
594  PKD_DISPATCH_TABLE CurrentTable;
595 
596  if (!KdpDebugMode.Value) return FALSE;
597 
598  /* Call the registered handlers */
599  CurrentEntry = KdProviders.Flink;
600  while (CurrentEntry != &KdProviders)
601  {
602  /* Get the current table */
603  CurrentTable = CONTAINING_RECORD(CurrentEntry,
604  KD_DISPATCH_TABLE,
605  KdProvidersList);
606 
607  /* Call it */
608  CurrentTable->KdpPrintRoutine(Output->Buffer, Output->Length);
609 
610  /* Next Table */
611  CurrentEntry = CurrentEntry->Flink;
612  }
613 
614  /* Call the Wrapper Routine */
615  if (WrapperTable.KdpPrintRoutine)
616  WrapperTable.KdpPrintRoutine(Output->Buffer, Output->Length);
617 
618  return FALSE;
619 }
620 
621 extern STRING KdbPromptString;
622 
623 BOOLEAN
624 NTAPI
626  _In_ PSTRING PromptString,
627  _In_ PSTRING ResponseString)
628 {
629  KIRQL OldIrql;
630  STRING StringChar;
631  CHAR Response;
632  USHORT i;
633  ULONG DummyScanCode;
634 
635  StringChar.Buffer = &Response;
636  StringChar.Length = StringChar.MaximumLength = sizeof(Response);
637 
638  /* Display the string and print a new line for log neatness */
639  KdpPrintString(PromptString);
640  *StringChar.Buffer = '\n';
641  KdpPrintString(&StringChar);
642 
643  /* Print the kdb prompt */
645 
646  // TODO: Use an improved KdbpReadCommand() function for our purposes.
647 
648  /* Acquire the printing spinlock without waiting at raised IRQL */
650 
652  KbdDisableMouse();
653 
654  /* Loop the whole string */
655  for (i = 0; i < ResponseString->MaximumLength; i++)
656  {
657  /* Check if this is serial debugging mode */
659  {
660  /* Get the character from serial */
661  do
662  {
664  } while (Response == -1);
665  }
666  else
667  {
668  /* Get the response from the keyboard */
669  do
670  {
671  Response = KdbpTryGetCharKeyboard(&DummyScanCode, MAXULONG);
672  } while (Response == -1);
673  }
674 
675  /* Check for return */
676  if (Response == '\r')
677  {
678  /*
679  * We might need to discard the next '\n'.
680  * Wait a bit to make sure we receive it.
681  */
683 
684  /* Check the mode */
686  {
687  /* Read and discard the next character, if any */
689  }
690  else
691  {
692  /* Read and discard the next character, if any */
693  KdbpTryGetCharKeyboard(&DummyScanCode, 5);
694  }
695 
696  /*
697  * Null terminate the output string -- documentation states that
698  * DbgPrompt does not null terminate, but it does
699  */
700  *(PCHAR)(ResponseString->Buffer + i) = 0;
701  break;
702  }
703 
704  /* Write it back and print it to the log */
705  *(PCHAR)(ResponseString->Buffer + i) = Response;
707  KdpPrintString(&StringChar);
709  }
710 
711  /* Return the length */
712  ResponseString->Length = i;
713 
715  KbdEnableMouse();
716 
717  /* Release the spinlock */
719 
720  /* Print a new line */
721  *StringChar.Buffer = '\n';
722  KdpPrintString(&StringChar);
723 
724  /* Success; we don't need to resend */
725  return FALSE;
726 }
727 
728 /* EOF */
signed char * PCHAR
Definition: retypes.h:7
static BOOLEAN KdpLoggingEnabled
Definition: kdio.c:20
static CHAR KdpScreenLineBuffer[KdpScreenLineLengthDefault+1]
Definition: kdio.c:37
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
VOID NTAPI InbvNotifyDisplayOwnershipLost(IN INBV_RESET_DISPLAY_PARAMETERS Callback)
Definition: inbv.c:641
#define IN
Definition: typedefs.h:38
#define THREAD_ALL_ACCESS
Definition: nt_native.h:1339
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
static HANDLE KdpLogFileHandle
Definition: kdio.c:26
PSTR ArcBootDeviceName
Definition: arc.h:503
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
KDP_DEBUG_MODE KdpDebugMode
Definition: kdinit.c:25
volatile ULONG KdpDmesgCurrentPosition
Definition: kdio.c:42
static volatile ULONG KdpFreeBytes
Definition: kdio.c:23
PCHAR KdpDmesgBuffer
Definition: kdio.c:41
ULONG KdbDebugState
Definition: kdb.c:45
char CHAR
Definition: xmlstorage.h:175
static ULONG KdpScreenLineLength
Definition: kdio.c:38
LONG NTSTATUS
Definition: precomp.h:26
_In_ KPRIORITY Priority
Definition: kefuncs.h:516
static KSPIN_LOCK KdpDmesgLogSpinLock
Definition: kdio.c:46
VOID NTAPI KdpSerialInit(PKD_DISPATCH_TABLE DispatchTable, ULONG BootPhase)
Definition: kdio.c:373
VOID NTAPI InbvSolidColorFill(IN ULONG Left, IN ULONG Top, IN ULONG Right, IN ULONG Bottom, IN ULONG Color)
Definition: inbv.c:719
static INIT_FUNCTION VOID KdpPrintBanner(IN SIZE_T MemSizeMBs)
Definition: kdio.c:103
KIRQL NTAPI KdpAcquireLock(IN PKSPIN_LOCK SpinLock)
Definition: kdio.c:116
static WCHAR String[]
Definition: stringtable.c:55
KSPIN_LOCK * PKSPIN_LOCK
Definition: env_spec_w32.h:73
GLuint GLuint end
Definition: gl.h:1545
#define InsertTailList(ListHead, Entry)
#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
LONG KPRIORITY
Definition: compat.h:462
#define pch(ap)
Definition: match.c:418
static KEVENT KdpLoggerThreadEvent
Definition: kdio.c:25
CHAR KdbpTryGetCharSerial(ULONG Retry)
Definition: kdb_serial.c:19
#define FILE_SHARE_READ
Definition: compat.h:125
CHAR KdbpTryGetCharKeyboard(PULONG ScanCode, ULONG Retry)
Definition: kdb_keyboard.c:104
LIST_ENTRY KdProviders
Definition: kdinit.c:29
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK SpinLock
Definition: iofuncs.h:798
static KSPIN_LOCK KdpDebugLogSpinLock
Definition: kdio.c:24
static VOID NTAPI KdpPrintToLogFile(PCHAR String, ULONG StringLength)
Definition: kdio.c:204
static VOID NTAPI KdpScreenPrint(PCHAR Message, ULONG Length)
Definition: kdio.c:450
BOOLEAN NTAPI KdPortInitializeEx(PCPPORT PortInformation, ULONG ComPortNumber)
UCHAR KIRQL
Definition: env_spec_w32.h:591
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
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:544
STRING KdbPromptString
Definition: kdb_cli.c:136
VOID FASTCALL KiReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: ntoskrnl.c:39
Definition: arc.h:130
ULONG KdpPort
Definition: kdio.c:34
#define DEFAULT_DEBUG_PORT
Definition: kdcom.c:18
VOID KdpScreenRelease(VOID)
Definition: kdio.c:431
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:251
#define FILE_WRITE_THROUGH
Definition: from_kernel.h:26
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
VOID KbdEnableMouse(VOID)
ANSI_STRING KdpLogFileName
Definition: kdio.c:27
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:2014
static VOID NTAPI KdpLoggerThread(PVOID Context)
Definition: kdio.c:157
PLOADER_PARAMETER_BLOCK KeLoaderBlock
Definition: krnlinit.c:29
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:695
VOID KdpScreenAcquire(VOID)
Definition: kdio.c:412
#define PCHAR
Definition: match.c:90
BOOLEAN FASTCALL KeTestSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:442
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
static volatile ULONG KdpCurrentPosition
Definition: kdio.c:22
#define DEFAULT_DEBUG_BAUD_RATE
Definition: kdcom.c:21
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)
return Iosb
Definition: create.c:4426
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define InterlockedExchangeAddUL(Addend, Value)
Definition: ex.h:1519
VOID KbdDisableMouse(VOID)
VOID NTAPI KdpReleaseLock(IN PKSPIN_LOCK SpinLock, IN KIRQL OldIrql)
Definition: kdio.c:142
GLuint GLuint num
Definition: glext.h:9618
#define KdpBufferSize
Definition: kdio.c:19
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define KdpScreenLineLengthDefault
Definition: kdio.c:36
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
Definition: ncftp.h:89
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static PCHAR KdpDebugBuffer
Definition: kdio.c:21
CHAR Message[80]
Definition: alive.c:5
std::wstring STRING
Definition: fontsub.cpp:33
VOID NTAPI InbvAcquireDisplayOwnership(VOID)
Definition: inbv.c:531
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
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)
VOID NTAPI KdpSerialDebugPrint(PCHAR Message, ULONG Length)
Definition: kdio.c:347
#define PAGE_SIZE
Definition: env_spec_w32.h:49
volatile ULONG KdpDmesgFreeBytes
Definition: kdio.c:43
Definition: typedefs.h:117
#define SYNCHRONIZE
Definition: nt_native.h:61
const ULONG KdpDmesgBufferSize
Definition: kdio.c:40
PUCHAR Address
Definition: cportlib.h:29
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
Status
Definition: gdiplustypes.h:24
#define MAXULONG
Definition: typedefs.h:250
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
BOOLEAN NTAPI InbvEnableDisplayString(IN BOOLEAN Enable)
Definition: inbv.c:609
#define _In_
Definition: no_sal2.h:204
BOOLEAN NTAPI InbvIsBootDriverInstalled(VOID)
Definition: inbv.c:633
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define HIGH_LEVEL
Definition: env_spec_w32.h:703
struct _FileName FileName
Definition: fatprocs.h:884
BOOLEAN NTAPI KdpPrintString(_In_ PSTRING Output)
Definition: kdio.c:590
PFN_COUNT MmNumberOfPhysicalPages
Definition: init.c:48
BOOLEAN NTAPI InbvResetDisplay(VOID)
Definition: inbv.c:667
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
unsigned short USHORT
Definition: pedump.c:61
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
static KSPIN_LOCK KdpSerialSpinLock
Definition: kdio.c:29
static LSA_DISPATCH_TABLE DispatchTable
Definition: authpackage.c:164
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
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
CPPORT SerialPortInfo
Definition: kdio.c:31
NTHALAPI VOID NTAPI HalDisplayString(PUCHAR String)
VOID NTAPI InbvInstallDisplayStringFilter(IN INBV_DISPLAY_STRING_FILTER Filter)
Definition: inbv.c:625
#define DPRINT1
Definition: precomp.h:8
ULONG SerialPortNumber
Definition: kdio.c:30
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
static ULONG KdpScreenLineBufferPos
Definition: kdio.c:38
volatile BOOLEAN KdbpIsInDmesgMode
Definition: kdio.c:45
KD_DISPATCH_TABLE WrapperTable
Definition: kdinit.c:28
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:566
#define FILE_SUPERSEDE
Definition: from_kernel.h:53
struct Response Response
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define ALIGN_UP_BY(size, align)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
VOID NTAPI KdpDebugLogInit(PKD_DISPATCH_TABLE DispatchTable, ULONG BootPhase)
Definition: kdio.c:247
static INIT_FUNCTION SIZE_T KdpGetMemorySizeInMBs(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kdio.c:62
BOOLEAN NTAPI InbvCheckDisplayOwnership(VOID)
Definition: inbv.c:556
VOID NTAPI InbvSetScrollRegion(IN ULONG Left, IN ULONG Top, IN ULONG Right, IN ULONG Bottom)
Definition: inbv.c:684
BOOLEAN FASTCALL KeTryToAcquireSpinLockAtDpcLevel(IN OUT PKSPIN_LOCK SpinLock)
Definition: spinlock.c:303
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
VOID NTAPI KeStallExecutionProcessor(IN ULONG MicroSeconds)
Definition: ntoskrnl.c:99
BOOLEAN NTAPI KdpPromptString(_In_ PSTRING PromptString, _In_ PSTRING ResponseString)
Definition: kdio.c:625
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PSTORAGE_DESCRIPTOR_HEADER * Descriptor
Definition: classpnp.h:966