[FREELDR][KDCOM][KDGDB][NTOS:KD] Minor code comments enhancements

This commit is contained in:
Hermès Bélusca-Maïto
2026-03-19 22:14:00 +01:00
parent bcd4c718c1
commit 4d0642b67f
6 changed files with 31 additions and 41 deletions
+3 -4
View File
@@ -57,10 +57,9 @@ BOOLEAN Rs232PortInitialize(IN ULONG ComPort,
if (ComPort == 0)
{
/*
* Start enumerating COM ports from the last one to the first one,
* and break when we find a valid port.
* If we reach the first element of the list, the invalid COM port,
* then it means that no valid port was found.
* Enumerate COM ports from the last to the first one, and stop
* when we find a valid port. If we reach the first list element
* (the undefined COM port), no valid port was found.
*/
for (ComPort = MAX_COM_PORTS; ComPort > 0; ComPort--)
{
+4 -6
View File
@@ -109,11 +109,11 @@ DebugInit(
/*
* Check if we got /DEBUGPORT parameters.
* NOTE: Inspired by reactos/ntoskrnl/kd/kdinit.c, KdInitSystem(...)
* NOTE: Inspired by ntoskrnl/kd/kdinit.c, KdInitSystem(...)
*/
while (PortString)
{
/* Move past the actual string, to reach the port*/
/* Move past the actual string */
PortString += strlen("DEBUGPORT");
/* Now get past any spaces and skip the equal sign */
@@ -147,13 +147,11 @@ DebugInit(
/* Check if we got a baud rate */
if (BaudString)
{
/* Move past the actual string, to reach the rate */
/* Move past the actual string and any spaces */
BaudString += strlen("BAUDRATE");
/* Now get past any spaces */
while (*BaudString == ' ') BaudString++;
/* And make sure we have a rate */
/* Make sure we have a rate */
if (*BaudString)
{
/* Read and set it */
+9 -12
View File
@@ -1,7 +1,7 @@
/*
* COPYRIGHT: GPL, see COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: drivers/base/kddll/kdcom.c
* FILE: drivers/base/kdcom/kdcom.c
* PURPOSE: COM port functions for the kernel debugger.
* PROGRAMMER: Timo Kreuzer ([email protected])
*/
@@ -147,7 +147,7 @@ KdDebuggerInitialize0(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
/* Check if we got the /DEBUGPORT parameter */
if (PortString)
{
/* Move past the actual string, to reach the port*/
/* Move past the actual string */
PortString += strlen("DEBUGPORT");
/* Now get past any spaces and skip the equal sign */
@@ -160,7 +160,7 @@ KdDebuggerInitialize0(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
return STATUS_INVALID_PARAMETER;
}
/* Check for a valid Serial Port */
/* Check for a valid serial port */
PortString += 3;
Value = atol(PortString);
if (Value >= sizeof(BaseArray) / sizeof(BaseArray[0]))
@@ -175,13 +175,11 @@ KdDebuggerInitialize0(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
/* Check if we got a baud rate */
if (BaudString)
{
/* Move past the actual string, to reach the rate */
/* Move past the actual string and any spaces */
BaudString += strlen("BAUDRATE");
/* Now get past any spaces */
while (*BaudString == ' ') BaudString++;
/* And make sure we have a rate */
/* Make sure we have a rate */
if (*BaudString)
{
/* Read and set it */
@@ -194,14 +192,13 @@ KdDebuggerInitialize0(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
#ifdef KDDEBUG
/*
* Try to find a free COM port and use it as the KD debugging port.
* NOTE: Inspired by reactos/boot/freeldr/freeldr/comm/rs232.c, Rs232PortInitialize(...)
* NOTE: Inspired by freeldr/comm/rs232.c, Rs232PortInitialize(...)
*/
{
/*
* Start enumerating COM ports from the last one to the first one,
* and break when we find a valid port.
* If we reach the first element of the list, the invalid COM port,
* then it means that no valid port was found.
* Enumerate COM ports from the last to the first one, and stop
* when we find a valid port. If we reach the first list element
* (the undefined COM port), no valid port was found.
*/
ULONG ComPort;
for (ComPort = MAX_COM_PORTS; ComPort > 0; ComPort--)
+8 -11
View File
@@ -141,7 +141,7 @@ KdDebuggerInitialize0(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
/* Check if we got the /DEBUGPORT parameter */
if (PortString)
{
/* Move past the actual string, to reach the port*/
/* Move past the actual string */
PortString += strlen("DEBUGPORT");
/* Now get past any spaces and skip the equal sign */
@@ -154,7 +154,7 @@ KdDebuggerInitialize0(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
return STATUS_INVALID_PARAMETER;
}
/* Check for a valid Serial Port */
/* Check for a valid serial port */
PortString += 3;
Value = atol(PortString);
if (Value >= sizeof(BaseArray) / sizeof(BaseArray[0]))
@@ -169,13 +169,11 @@ KdDebuggerInitialize0(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
/* Check if we got a baud rate */
if (BaudString)
{
/* Move past the actual string, to reach the rate */
/* Move past the actual string and any spaces */
BaudString += strlen("BAUDRATE");
/* Now get past any spaces */
while (*BaudString == ' ') BaudString++;
/* And make sure we have a rate */
/* Make sure we have a rate */
if (*BaudString)
{
/* Read and set it */
@@ -188,14 +186,13 @@ KdDebuggerInitialize0(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
#ifdef KDDEBUG
/*
* Try to find a free COM port and use it as the KD debugging port.
* NOTE: Inspired by reactos/boot/freeldr/freeldr/comm/rs232.c, Rs232PortInitialize(...)
* NOTE: Inspired by freeldr/comm/rs232.c, Rs232PortInitialize(...)
*/
{
/*
* Start enumerating COM ports from the last one to the first one,
* and break when we find a valid port.
* If we reach the first element of the list, the invalid COM port,
* then it means that no valid port was found.
* Enumerate COM ports from the last to the first one, and stop
* when we find a valid port. If we reach the first list element
* (the undefined COM port), no valid port was found.
*/
ULONG ComPort;
for (ComPort = MAX_COM_PORTS; ComPort > 0; ComPort--)
+3 -4
View File
@@ -45,10 +45,9 @@ KdPortInitializeEx(
if (ComPortNumber == 0)
{
/*
* Start enumerating COM ports from the last one to the first one,
* and break when we find a valid port.
* If we reach the first element of the list, the invalid COM port,
* then it means that no valid port was found.
* Enumerate COM ports from the last to the first one, and stop
* when we find a valid port. If we reach the first list element
* (the undefined COM port), no valid port was found.
*/
for (ComPortNumber = MAX_COM_PORTS; ComPortNumber > 0; ComPortNumber--)
{
+4 -4
View File
@@ -59,14 +59,14 @@ KdpGetDebugMode(
/* Check for Screen Debugging */
if (!_strnicmp(p2, "SCREEN", 6))
{
/* Enable It */
/* Enable it */
p2 += 6;
KdpDebugMode.Screen = TRUE;
}
/* Check for Serial Debugging */
else if (!_strnicmp(p2, "COM", 3))
{
/* Check for a valid Serial Port */
/* Check for a valid serial port */
p2 += 3;
if (*p2 != ':')
{
@@ -94,7 +94,7 @@ KdpGetDebugMode(
/* Check for Debug Log Debugging */
else if (!_strnicmp(p2, "FILE", 4))
{
/* Enable It */
/* Enable it */
p2 += 4;
KdpDebugMode.File = TRUE;
if (*p2 == ':')
@@ -139,7 +139,7 @@ KdDebuggerInitialize0(
/* Check if we got the /DEBUGPORT parameter(s) */
while (Port)
{
/* Move past the actual string, to reach the port*/
/* Move past the actual string */
Port += sizeof("DEBUGPORT") - 1;
/* Now get past any spaces and skip the equal sign */