mirror of
https://github.com/reactos/reactos.git
synced 2025-06-01 15:38:37 +00:00
[NTOS:KD] Check for valid LoaderBlock and LoaderBlock->LoadOptions pointers when calling KdInitSystem() in BootPhase == 0.
This commit is contained in:
parent
ef5f034974
commit
954f7c0660
1 changed files with 37 additions and 25 deletions
|
@ -84,7 +84,6 @@ KdpGetDebugMode(PCHAR Currentp2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for Debug Log Debugging */
|
/* Check for Debug Log Debugging */
|
||||||
else if (!_strnicmp(p2, "FILE", 4))
|
else if (!_strnicmp(p2, "FILE", 4))
|
||||||
{
|
{
|
||||||
|
@ -100,7 +99,6 @@ KdpGetDebugMode(PCHAR Currentp2)
|
||||||
KdpLogFileName.Buffer = p1;
|
KdpLogFileName.Buffer = p1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for BOCHS Debugging */
|
/* Check for BOCHS Debugging */
|
||||||
else if (!_strnicmp(p2, "BOCHS", 5))
|
else if (!_strnicmp(p2, "BOCHS", 5))
|
||||||
{
|
{
|
||||||
|
@ -108,7 +106,6 @@ KdpGetDebugMode(PCHAR Currentp2)
|
||||||
p2 += 5;
|
p2 += 5;
|
||||||
KdpDebugMode.Bochs = TRUE;
|
KdpDebugMode.Bochs = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for GDB Debugging */
|
/* Check for GDB Debugging */
|
||||||
else if (!_strnicmp(p2, "GDB", 3))
|
else if (!_strnicmp(p2, "GDB", 3))
|
||||||
{
|
{
|
||||||
|
@ -122,7 +119,6 @@ KdpGetDebugMode(PCHAR Currentp2)
|
||||||
SharedUserData->KdDebuggerEnabled = TRUE;
|
SharedUserData->KdDebuggerEnabled = TRUE;
|
||||||
WrapperInitRoutine = KdpGdbStubInit;
|
WrapperInitRoutine = KdpGdbStubInit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for PICE Debugging */
|
/* Check for PICE Debugging */
|
||||||
else if (!_strnicmp(p2, "PICE", 4))
|
else if (!_strnicmp(p2, "PICE", 4))
|
||||||
{
|
{
|
||||||
|
@ -175,39 +171,55 @@ KdInitSystem(ULONG BootPhase,
|
||||||
{
|
{
|
||||||
ULONG Value;
|
ULONG Value;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
PCHAR CommandLine, Port, BaudRate, Irq;
|
PCHAR CommandLine, Port = NULL, BaudRate = NULL, Irq = NULL;
|
||||||
|
|
||||||
/* Set Default Port Options */
|
/* Set Default Port Options */
|
||||||
if (BootPhase == 0)
|
if (BootPhase == 0)
|
||||||
{
|
{
|
||||||
/* Get the Command Line */
|
/* Check if we have a loader block */
|
||||||
CommandLine = LoaderBlock->LoadOptions;
|
if (LoaderBlock)
|
||||||
|
|
||||||
/* Upcase it */
|
|
||||||
_strupr(CommandLine);
|
|
||||||
|
|
||||||
/* XXX Check for settings that we support */
|
|
||||||
if (strstr(CommandLine, "NODEBUG")) KdDebuggerEnabled = FALSE;
|
|
||||||
else if (strstr(CommandLine, "CRASHDEBUG")) KdDebuggerEnabled = FALSE;
|
|
||||||
else if (strstr(CommandLine, "DEBUG"))
|
|
||||||
{
|
{
|
||||||
/* Enable the kernel debugger */
|
/* Check if we have a command line */
|
||||||
KdDebuggerNotPresent = FALSE;
|
CommandLine = LoaderBlock->LoadOptions;
|
||||||
KdDebuggerEnabled = TRUE;
|
if (CommandLine)
|
||||||
|
{
|
||||||
|
/* Upcase it */
|
||||||
|
_strupr(CommandLine);
|
||||||
|
|
||||||
|
/* XXX Check for settings that we support */
|
||||||
|
if (strstr(CommandLine, "NODEBUG")) KdDebuggerEnabled = FALSE;
|
||||||
|
else if (strstr(CommandLine, "CRASHDEBUG")) KdDebuggerEnabled = FALSE;
|
||||||
|
else if (strstr(CommandLine, "DEBUG"))
|
||||||
|
{
|
||||||
|
/* Enable the kernel debugger */
|
||||||
|
KdDebuggerNotPresent = FALSE;
|
||||||
|
KdDebuggerEnabled = TRUE;
|
||||||
#ifdef KDBG
|
#ifdef KDBG
|
||||||
/* Get the KDBG Settings */
|
/* Get the KDBG Settings */
|
||||||
KdbpGetCommandLineSettings(LoaderBlock->LoadOptions);
|
KdbpGetCommandLineSettings(LoaderBlock->LoadOptions);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the port and baud rate */
|
||||||
|
Port = strstr(CommandLine, "DEBUGPORT");
|
||||||
|
BaudRate = strstr(CommandLine, "BAUDRATE");
|
||||||
|
Irq = strstr(CommandLine, "IRQ");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* No command line options? Disable debugger by default */
|
||||||
|
KdDebuggerEnabled = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Called from a bugcheck or a re-enable. Unconditionally enable KD */
|
||||||
|
KdDebuggerEnabled = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Let user-mode know our state */
|
/* Let user-mode know our state */
|
||||||
SharedUserData->KdDebuggerEnabled = KdDebuggerEnabled;
|
SharedUserData->KdDebuggerEnabled = KdDebuggerEnabled;
|
||||||
|
|
||||||
/* Get the port and baud rate */
|
|
||||||
Port = strstr(CommandLine, "DEBUGPORT");
|
|
||||||
BaudRate = strstr(CommandLine, "BAUDRATE");
|
|
||||||
Irq = strstr(CommandLine, "IRQ");
|
|
||||||
|
|
||||||
/* Check if we got the /DEBUGPORT parameter(s) */
|
/* Check if we got the /DEBUGPORT parameter(s) */
|
||||||
while (Port)
|
while (Port)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue