From 4ce30245de5adb515edad0c72c3187ecc74f1aa8 Mon Sep 17 00:00:00 2001 From: Dmitry Gorbachev Date: Tue, 22 Nov 2011 02:30:16 +0000 Subject: [PATCH] [NTOSKRNL|KDCOM] 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 | 28 +++++++++++++++++--------- reactos/ntoskrnl/kd/kdinit.c | 28 +++++++++++++++++++------- 2 files changed, 39 insertions(+), 17 deletions(-) diff --git a/reactos/drivers/base/kdcom/i386/kdbg.c b/reactos/drivers/base/kdcom/i386/kdbg.c index 5f91cf083b2..3c729988f3d 100644 --- a/reactos/drivers/base/kdcom/i386/kdbg.c +++ b/reactos/drivers/base/kdcom/i386/kdbg.c @@ -258,19 +258,27 @@ KdPortInitializeEx( if (PortInformation->BaudRate == 0) PortInformation->BaudRate = DEFAULT_BAUD_RATE; - if (PortInformation->ComPort == 0) - return FALSE; - - if (!KdpDoesComPortExist(BaseArray[PortInformation->ComPort])) + if (PortInformation->ComPort != 0) { - sprintf(buffer, - "\nKernel Debugger: Serial port not found!\n\n"); - HalDisplayString(buffer); - 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; + } + else + { + 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", diff --git a/reactos/ntoskrnl/kd/kdinit.c b/reactos/ntoskrnl/kd/kdinit.c index 09853fcf645..1f3c0ce8277 100644 --- a/reactos/ntoskrnl/kd/kdinit.c +++ b/reactos/ntoskrnl/kd/kdinit.c @@ -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; + } } }