[NTOSKRNL|KDCOM]
authorDmitry Gorbachev <gorbachev@reactos.org>
Tue, 22 Nov 2011 02:30:16 +0000 (02:30 +0000)
committerDmitry Gorbachev <gorbachev@reactos.org>
Tue, 22 Nov 2011 02:30:16 +0000 (02:30 +0000)
Allow to specify the serial port address, as requested by people on the forum.

svn path=/trunk/; revision=54473

reactos/drivers/base/kdcom/i386/kdbg.c
reactos/ntoskrnl/kd/kdinit.c

index 5f91cf0..3c72998 100644 (file)
@@ -258,19 +258,27 @@ KdPortInitializeEx(
     if (PortInformation->BaudRate == 0)
         PortInformation->BaudRate = DEFAULT_BAUD_RATE;
 
-    if (PortInformation->ComPort == 0)
-        return FALSE;
+    if (PortInformation->ComPort != 0)
+    {
+        if (!KdpDoesComPortExist(BaseArray[PortInformation->ComPort]))
+        {
+            sprintf(buffer,
+                    "\nKernel Debugger: Serial port not found!\n\n");
+            HalDisplayString(buffer);
+            return FALSE;
+        }
 
-    if (!KdpDoesComPortExist(BaseArray[PortInformation->ComPort]))
+        ComPortBase = BaseArray[PortInformation->ComPort];
+        PortInformation->BaseAddress = ComPortBase;
+    }
+    else
     {
-        sprintf(buffer,
-                "\nKernel Debugger: Serial port not found!\n\n");
-        HalDisplayString(buffer);
-        return FALSE;
+        ComPortBase = PortInformation->BaseAddress;
     }
 
-    ComPortBase = BaseArray[PortInformation->ComPort];
-    PortInformation->BaseAddress = ComPortBase;
+    if (ComPortBase == 0)
+        return FALSE;
+
 #ifndef NDEBUG
     sprintf(buffer,
             "\nSerial port COM%ld found at 0x%lx\n",
index 09853fc..1f3c0ce 100644 (file)
@@ -64,15 +64,29 @@ KdpGetDebugMode(PCHAR Currentp2)
     {
         /* Gheck for a valid Serial Port */
         p2 += 3;
-        Value = (ULONG)atol(p2);
-        if (Value > 0 && Value < 5)
+        if (*p2 != ':')
         {
-            /* Valid port found, enable Serial Debugging */
-            KdpDebugMode.Serial = TRUE;
+            Value = (ULONG)atol(p2);
+            if (Value > 0 && Value < 5)
+            {
+                /* Valid port found, enable Serial Debugging */
+                KdpDebugMode.Serial = TRUE;
 
-            /* Set the port to use */
-            SerialPortInfo.ComPort = Value;
-            KdpPort = Value;
+                /* Set the port to use */
+                SerialPortInfo.ComPort = Value;
+                KdpPort = Value;
+            }
+        }
+        else
+        {
+            Value = strtoul(p2 + 1, NULL, 0);
+            if (Value)
+            {
+                KdpDebugMode.Serial = TRUE;
+                SerialPortInfo.BaseAddress = Value;
+                SerialPortInfo.ComPort = 0;
+                KdpPort = 0;
+            }
         }
     }