Author: dgorbachev
Date: Tue Nov 22 02:30:16 2011
New Revision: 54473

URL: http://svn.reactos.org/svn/reactos?rev=54473&view=rev
Log:
[NTOSKRNL|KDCOM]
Allow to specify the serial port address, as requested by people on the forum.

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

Modified: trunk/reactos/drivers/base/kdcom/i386/kdbg.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/kdcom/i386/kdbg.c?rev=54473&r1=54472&r2=54473&view=diff
==============================================================================
--- trunk/reactos/drivers/base/kdcom/i386/kdbg.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/kdcom/i386/kdbg.c [iso-8859-1] Tue Nov 22 
02:30:16 2011
@@ -258,19 +258,27 @@
     if (PortInformation->BaudRate == 0)
         PortInformation->BaudRate = DEFAULT_BAUD_RATE;
 
-    if (PortInformation->ComPort == 0)
+    if (PortInformation->ComPort != 0)
+    {
+        if (!KdpDoesComPortExist(BaseArray[PortInformation->ComPort]))
+        {
+            sprintf(buffer,
+                    "\nKernel Debugger: Serial port not found!\n\n");
+            HalDisplayString(buffer);
+            return FALSE;
+        }
+
+        ComPortBase = BaseArray[PortInformation->ComPort];
+        PortInformation->BaseAddress = ComPortBase;
+    }
+    else
+    {
+        ComPortBase = PortInformation->BaseAddress;
+    }
+
+    if (ComPortBase == 0)
         return FALSE;
 
-    if (!KdpDoesComPortExist(BaseArray[PortInformation->ComPort]))
-    {
-        sprintf(buffer,
-                "\nKernel Debugger: Serial port not found!\n\n");
-        HalDisplayString(buffer);
-        return FALSE;
-    }
-
-    ComPortBase = BaseArray[PortInformation->ComPort];
-    PortInformation->BaseAddress = ComPortBase;
 #ifndef NDEBUG
     sprintf(buffer,
             "\nSerial port COM%ld found at 0x%lx\n",

Modified: trunk/reactos/ntoskrnl/kd/kdinit.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd/kdinit.c?rev=54473&r1=54472&r2=54473&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/kd/kdinit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kd/kdinit.c [iso-8859-1] Tue Nov 22 02:30:16 2011
@@ -64,15 +64,29 @@
     {
         /* Gheck for a valid Serial Port */
         p2 += 3;
-        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;
+        if (*p2 != ':')
+        {
+            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;
+            }
+        }
+        else
+        {
+            Value = strtoul(p2 + 1, NULL, 0);
+            if (Value)
+            {
+                KdpDebugMode.Serial = TRUE;
+                SerialPortInfo.BaseAddress = Value;
+                SerialPortInfo.ComPort = 0;
+                KdpPort = 0;
+            }
         }
     }
 


Reply via email to