[KD] Output the long commit hash as well at the start of the debug log.
[reactos.git] / ntoskrnl / kd / kdio.c
index bcddcdb..40795de 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <ntoskrnl.h>
 #include <reactos/buildno.h>
+#define NDEBUG
 #include <debug.h>
 
 /* GLOBALS *******************************************************************/
@@ -26,13 +27,14 @@ HANDLE KdpLogFileHandle;
 ANSI_STRING KdpLogFileName = RTL_CONSTANT_STRING("\\SystemRoot\\debug.log");
 
 KSPIN_LOCK KdpSerialSpinLock;
-KD_PORT_INFORMATION SerialPortInfo = { DEFAULT_DEBUG_PORT, DEFAULT_DEBUG_BAUD_RATE, 0 };
+ULONG  SerialPortNumber = DEFAULT_DEBUG_PORT;
+CPPORT SerialPortInfo   = {0, DEFAULT_DEBUG_BAUD_RATE, 0};
 
 /* Current Port in use. FIXME: Do we support more then one? */
 ULONG KdpPort;
 
-#define KdpScreenLineLenght 80
-CHAR KdpScreenLineBuffer[KdpScreenLineLenght + 1] = "";
+#define KdpScreenLineLengthDefault 80
+CHAR KdpScreenLineBuffer[KdpScreenLineLengthDefault + 1] = "";
 ULONG KdpScreenLineBufferPos = 0, KdpScreenLineLength = 0;
 
 const ULONG KdpDmesgBufferSize = 128 * 1024; // 512*1024; // 5*1024*1024;
@@ -52,9 +54,11 @@ volatile BOOLEAN KdbpIsInDmesgMode = FALSE;
  *
  * Strongly inspired by:
  * mm\ARM3\mminit.c : MiScanMemoryDescriptors(...)
+ *
+ * See also: kd64\kdinit.c
  */
-SIZE_T
-NTAPI
+static SIZE_T
+INIT_FUNCTION
 KdpGetMemorySizeInMBs(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
 {
     PLIST_ENTRY ListEntry;
@@ -239,14 +243,19 @@ KdpInitDebugLog(PKD_DISPATCH_TABLE DispatchTable,
         KeInitializeSpinLock(&KdpDebugLogSpinLock);
 
         /* Display separator + ReactOS version at start of the debug log */
-        DPRINT1("---------------------------------------------------------------\n");
+        DPRINT1("-----------------------------------------------------\n");
         DPRINT1("ReactOS "KERNEL_VERSION_STR" (Build "KERNEL_VERSION_BUILD_STR")\n");
         MemSizeMBs = MmNumberOfPhysicalPages * PAGE_SIZE / 1024 / 1024;
         DPRINT1("%u System Processor [%u MB Memory]\n", KeNumberProcessors, MemSizeMBs);
+        DPRINT1("Command Line: %s\n", KeLoaderBlock->LoadOptions);
+        DPRINT1("ARC Paths: %s %s %s %s\n", KeLoaderBlock->ArcBootDeviceName,
+                                            KeLoaderBlock->NtHalPathName,
+                                            KeLoaderBlock->ArcHalDeviceName,
+                                            KeLoaderBlock->NtBootPathName);
     }
     else if (BootPhase == 2)
     {
-        HalDisplayString("\n   File log debugging enabled\n\n");
+        HalDisplayString("\r\n   File log debugging enabled\r\n\r\n");
     }
     else if (BootPhase == 3)
     {
@@ -358,12 +367,12 @@ KdpSerialInit(PKD_DISPATCH_TABLE DispatchTable,
         DispatchTable->KdpPrintRoutine = KdpSerialDebugPrint;
 
         /* Initialize the Port */
-        if (!KdPortInitializeEx(&SerialPortInfo, 0, 0))
+        if (!KdPortInitializeEx(&SerialPortInfo, SerialPortNumber))
         {
             KdpDebugMode.Serial = FALSE;
             return;
         }
-        KdComPortInUse = (PUCHAR)(ULONG_PTR)SerialPortInfo.BaseAddress;
+        KdComPortInUse = SerialPortInfo.Address;
 
         /* Initialize spinlock */
         KeInitializeSpinLock(&KdpSerialSpinLock);
@@ -373,7 +382,7 @@ KdpSerialInit(PKD_DISPATCH_TABLE DispatchTable,
 
         /* Display separator + ReactOS version at start of the debug log */
         DPRINT1("-----------------------------------------------------\n");
-        DPRINT1("ReactOS "KERNEL_VERSION_STR" (Build "KERNEL_VERSION_BUILD_STR")\n");
+        DPRINT1("ReactOS " KERNEL_VERSION_STR " (Build " KERNEL_VERSION_BUILD_STR ") (Commit " KERNEL_VERSION_COMMIT_HASH "\n");
         MemSizeMBs = KdpGetMemorySizeInMBs(KeLoaderBlock);
         DPRINT1("%u System Processor [%u MB Memory]\n", KeNumberProcessors, MemSizeMBs);
         DPRINT1("Command Line: %s\n", KeLoaderBlock->LoadOptions);
@@ -384,7 +393,7 @@ KdpSerialInit(PKD_DISPATCH_TABLE DispatchTable,
     }
     else if (BootPhase == 2)
     {
-        HalDisplayString("\n   Serial debugging enabled\n\n");
+        HalDisplayString("\r\n   Serial debugging enabled\r\n\r\n");
     }
 }
 
@@ -427,7 +436,7 @@ KdpScreenPrint(LPSTR Message,
             KdpScreenLineBuffer[KdpScreenLineLength] = '\0';
         }
 
-        if(*pch == '\n' || KdpScreenLineLength == KdpScreenLineLenght)
+        if(*pch == '\n' || KdpScreenLineLength == KdpScreenLineLengthDefault)
         {
             /* Print buffered characters */
             if(KdpScreenLineBufferPos != KdpScreenLineLength)
@@ -559,7 +568,7 @@ KdpScreenInit(PKD_DISPATCH_TABLE DispatchTable,
     }
     else if (BootPhase == 2)
     {
-        HalDisplayString("\n   Screen debugging enabled\n\n");
+        HalDisplayString("\r\n   Screen debugging enabled\r\n\r\n");
     }
 }