forked from Bananymous/banan-os
Kernel: Add command line option to disable debug printing
The whole system can crash when debug output and tty output are done at the same time. This patch is just a hack to prevent the crash :D
This commit is contained in:
parent
bec3e8654f
commit
2ce7205c80
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
bool g_disable_debug = false;
|
||||||
extern Kernel::TerminalDriver* g_terminal_driver;
|
extern Kernel::TerminalDriver* g_terminal_driver;
|
||||||
|
|
||||||
namespace Debug
|
namespace Debug
|
||||||
|
@ -70,6 +71,9 @@ namespace Debug
|
||||||
{
|
{
|
||||||
using namespace Kernel;
|
using namespace Kernel;
|
||||||
|
|
||||||
|
if (g_disable_debug)
|
||||||
|
return;
|
||||||
|
|
||||||
if (Kernel::Serial::has_devices())
|
if (Kernel::Serial::has_devices())
|
||||||
return Kernel::Serial::putchar_any(ch);
|
return Kernel::Serial::putchar_any(ch);
|
||||||
if (Kernel::TTY::is_initialized())
|
if (Kernel::TTY::is_initialized())
|
||||||
|
|
|
@ -65,6 +65,7 @@ static bool should_disable_serial(BAN::StringView full_command_line)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern bool g_disable_debug;
|
||||||
static ParsedCommandLine cmdline;
|
static ParsedCommandLine cmdline;
|
||||||
|
|
||||||
static void parse_command_line()
|
static void parse_command_line()
|
||||||
|
@ -81,6 +82,8 @@ static void parse_command_line()
|
||||||
cmdline.disable_smp = true;
|
cmdline.disable_smp = true;
|
||||||
else if (argument == "nousb")
|
else if (argument == "nousb")
|
||||||
cmdline.disable_usb = true;
|
cmdline.disable_usb = true;
|
||||||
|
else if (argument == "nodebug")
|
||||||
|
g_disable_debug = true;
|
||||||
else if (argument.starts_with("ps2="))
|
else if (argument.starts_with("ps2="))
|
||||||
{
|
{
|
||||||
if (argument.size() != 5 || !isdigit(argument[4]))
|
if (argument.size() != 5 || !isdigit(argument[4]))
|
||||||
|
|
Loading…
Reference in New Issue