/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
- * FILE: drivers/base/kdcom/kdbg.c
+ * FILE: ntoskrnl/kd/i386/kdbg.c
* PURPOSE: Serial i/o functions for the kernel debugger.
* PROGRAMMER: Alex Ionescu
* Hervé Poussineau
#error Unknown architecture
#endif
+#define MAX_COM_PORTS (sizeof(BaseArray) / sizeof(BaseArray[0]) - 1)
+
/* STATIC VARIABLES ***********************************************************/
// static CPPORT DefaultPort = {0, 0, 0};
/* The COM port must only be initialized once! */
// static BOOLEAN PortInitialized = FALSE;
-
/* REACTOS FUNCTIONS **********************************************************/
NTSTATUS
/*
* Find the port if needed
*/
- SIZE_T i;
if (!PortInitialized)
{
* If we reach the first element of the list, the invalid COM port,
* then it means that no valid port was found.
*/
- for (i = sizeof(BaseArray) / sizeof(BaseArray[0]) - 1; i > 0; i--)
+ for (ComPortNumber = MAX_COM_PORTS; ComPortNumber > 0; ComPortNumber--)
{
- if (CpDoesPortExist(UlongToPtr(BaseArray[i])))
+ if (CpDoesPortExist(UlongToPtr(BaseArray[ComPortNumber])))
{
- PortInformation->Address = DefaultPort.Address = BaseArray[i];
- ComPortNumber = (ULONG)i;
+ PortInformation->Address = DefaultPort.Address = BaseArray[ComPortNumber];
break;
}
}
/* Print message to blue screen */
sprintf(buffer,
- "\r\nKernel Debugger: Serial port found: COM%ld (Port 0x%lx) BaudRate %ld\r\n\r\n",
+ "\r\nKernel Debugger: Serial port found: COM%ld (Port 0x%p) BaudRate %ld\r\n\r\n",
ComPortNumber,
PortInformation->Address,
PortInformation->BaudRate);