[FREELDR][KDCOM][KDGDB] Remove deprecated "IRQ" debugger command-line option

- The "IRQ" debugger option was introduced in commit 5a6adb4f13 (r2546).
  It was used by the in-kernel GDB stub, to manually wire an interrupt
  handler `GspBreakIn()` to allow the debugger to break into the system
  when a command is received on the GDB serial port.

  Side-remark:
  The hooking was done via `HalGetInterruptVector()` + `IoConnectInterrupt()`,
  but only at phase 1 initialization when the memory manager was up, which
  can be "late" enough during system boot initialization.
  Instead of using `IoConnectInterrupt()`, one could have used explicit
  `KeInitializeInterrupt()` + `KeConnectInterrupt()` calls that would
  have worked much earlier in the boot stage.

- This functionality was soon after disabled in commit c804ca06be (r2946)
  in the GDB stub (see `ntoskrnl/kd/gdbstub.c!KdGdbStubInit()`), never
  to be re-enabled again.
  It was removed completely in commit e160c0fb26 (r14799).

- Since ReactOS was (until recently) always debugged locally using the
  in-kernel KDBG debugger, break-in was done with TAB-K keypress,
  intercepted by the keyboard driver that triggered a `DbgBreakPoint()`,
  thus no break-in via serial port interrupt was necessary.

- Remote debugger break-in detection, which is the standard method that
  is used when remote-debugging using KD transport DLLs and WinDbg, was
  introduced in commit 12e7593f24 (r25984). As with the rest of debugger
  communication and as done on Windows, detection is done by polling the
  serial port at certain times, namely in the `KeUpdateSystemTime()`
  kernel procedure periodically invoked by the timer interrupt.
  This break-in detection was then erroneously removed in commit bf8b9467dc
  (r45140), and reinstated in commit 014b23b9a (r56194).

- Parsing of this "IRQ" option was copy-pasted in other modules (FreeLoader,
  KDCOM, and KDGDB), even though it was never used. The parsing was then
  removed in KDBG itself in commit 95faf65ebf, but left in the other
  modules... until now!
This commit is contained in:
Hermès Bélusca-Maïto
2026-03-19 21:52:14 +01:00
parent fe6ee1223a
commit b1a31610ac
4 changed files with 3 additions and 67 deletions
+1 -21
View File
@@ -46,7 +46,6 @@ ULONG DebugPort = RS232;
#include <cportlib/uartinfo.h>
ULONG BaudRate = DEFAULT_DEBUG_BAUD_RATE;
ULONG ComPort = 0; // The COM port initializer chooses the first available port starting from COM4 down to COM1.
ULONG PortIrq = 0; // Not used at the moment.
BOOLEAN DebugStartOfLine = TRUE;
@@ -60,7 +59,7 @@ DebugInit(
_In_ PCSTR DebugString)
{
static BOOLEAN Initialized = FALSE;
PSTR CommandLine, PortString, BaudString, IrqString;
PSTR CommandLine, PortString, BaudString;
ULONG Value;
CHAR DbgStringBuffer[256];
@@ -107,7 +106,6 @@ DebugInit(
/* Get the port and baud rate */
PortString = strstr(CommandLine, "DEBUGPORT");
BaudString = strstr(CommandLine, "BAUDRATE");
IrqString = strstr(CommandLine, "IRQ");
/*
* Check if we got /DEBUGPORT parameters.
@@ -164,24 +162,6 @@ DebugInit(
}
}
/* Check Serial Port Settings [IRQ] */
if (IrqString)
{
/* Move past the actual string, to reach the rate */
IrqString += strlen("IRQ");
/* Now get past any spaces */
while (*IrqString == ' ') IrqString++;
/* And make sure we have an IRQ */
if (*IrqString)
{
/* Read and set it */
Value = atol(IrqString + 1);
if (Value) PortIrq = Value;
}
}
Done:
Initialized = TRUE;
+1 -21
View File
@@ -19,7 +19,6 @@
/* GLOBALS ********************************************************************/
CPPORT KdComPort;
ULONG KdComPortIrq = 0; // Not used at the moment.
#ifdef KDDEBUG
CPPORT KdDebugComPort;
#endif
@@ -129,7 +128,7 @@ KdDebuggerInitialize0(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
ULONG ComPortNumber = DEFAULT_DEBUG_PORT;
ULONG ComPortBaudRate = DEFAULT_DEBUG_BAUD_RATE;
PCHAR CommandLine, PortString, BaudString, IrqString;
PSTR CommandLine, PortString, BaudString;
ULONG Value;
/* Check if we have a LoaderBlock */
@@ -144,7 +143,6 @@ KdDebuggerInitialize0(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
/* Get the port and baud rate */
PortString = strstr(CommandLine, "DEBUGPORT");
BaudString = strstr(CommandLine, "BAUDRATE");
IrqString = strstr(CommandLine, "IRQ");
/* Check if we got the /DEBUGPORT parameter */
if (PortString)
@@ -191,24 +189,6 @@ KdDebuggerInitialize0(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
if (Value) ComPortBaudRate = Value;
}
}
/* Check Serial Port Settings [IRQ] */
if (IrqString)
{
/* Move past the actual string, to reach the rate */
IrqString += strlen("IRQ");
/* Now get past any spaces */
while (*IrqString == ' ') IrqString++;
/* And make sure we have an IRQ */
if (*IrqString)
{
/* Read and set it */
Value = atol(IrqString + 1);
if (Value) KdComPortIrq = Value;
}
}
}
#ifdef KDDEBUG
+1 -21
View File
@@ -17,7 +17,6 @@
/* GLOBALS ********************************************************************/
CPPORT KdComPort;
ULONG KdComPortIrq = 0; // Not used at the moment.
#ifdef KDDEBUG
CPPORT KdDebugComPort;
#endif
@@ -123,7 +122,7 @@ KdDebuggerInitialize0(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
ULONG ComPortNumber = DEFAULT_DEBUG_PORT;
ULONG ComPortBaudRate = DEFAULT_DEBUG_BAUD_RATE;
PCHAR CommandLine, PortString, BaudString, IrqString;
PSTR CommandLine, PortString, BaudString;
ULONG Value;
/* Check if we have a LoaderBlock */
@@ -138,7 +137,6 @@ KdDebuggerInitialize0(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
/* Get the port and baud rate */
PortString = strstr(CommandLine, "DEBUGPORT");
BaudString = strstr(CommandLine, "BAUDRATE");
IrqString = strstr(CommandLine, "IRQ");
/* Check if we got the /DEBUGPORT parameter */
if (PortString)
@@ -185,24 +183,6 @@ KdDebuggerInitialize0(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
if (Value) ComPortBaudRate = Value;
}
}
/* Check Serial Port Settings [IRQ] */
if (IrqString)
{
/* Move past the actual string, to reach the rate */
IrqString += strlen("IRQ");
/* Now get past any spaces */
while (*IrqString == ' ') IrqString++;
/* And make sure we have an IRQ */
if (*IrqString)
{
/* Read and set it */
Value = atol(IrqString + 1);
if (Value) KdComPortIrq = Value;
}
}
}
#ifdef KDDEBUG
@@ -11,13 +11,9 @@
/* Serial debug connection */
#if defined(SARCH_PC98)
#define DEFAULT_DEBUG_PORT 2 /* COM2 */
#define DEFAULT_DEBUG_COM1_IRQ 4
#define DEFAULT_DEBUG_COM2_IRQ 5
#define DEFAULT_DEBUG_BAUD_RATE 9600
#else
#define DEFAULT_DEBUG_PORT 2 /* COM2 */
#define DEFAULT_DEBUG_COM1_IRQ 4
#define DEFAULT_DEBUG_COM2_IRQ 3
#define DEFAULT_DEBUG_BAUD_RATE 115200
#endif