summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/CommandLine.cpp5
-rw-r--r--Kernel/CommandLine.h1
-rw-r--r--Kernel/Panic.cpp2
3 files changed, 8 insertions, 0 deletions
diff --git a/Kernel/CommandLine.cpp b/Kernel/CommandLine.cpp
index 1d68751762..e87565c32d 100644
--- a/Kernel/CommandLine.cpp
+++ b/Kernel/CommandLine.cpp
@@ -27,6 +27,11 @@ UNMAP_AFTER_INIT void CommandLine::early_initialize(const char* cmd_line)
s_cmd_line[length] = '\0';
}
+bool CommandLine::was_initialized()
+{
+ return s_the != nullptr;
+}
+
const CommandLine& kernel_command_line()
{
VERIFY(s_the);
diff --git a/Kernel/CommandLine.h b/Kernel/CommandLine.h
index a007fdab36..f28b97a0de 100644
--- a/Kernel/CommandLine.h
+++ b/Kernel/CommandLine.h
@@ -45,6 +45,7 @@ class CommandLine {
public:
static void early_initialize(const char* cmd_line);
static void initialize();
+ static bool was_initialized();
enum class Validate {
Yes,
diff --git a/Kernel/Panic.cpp b/Kernel/Panic.cpp
index c2022d8486..34100a1bdb 100644
--- a/Kernel/Panic.cpp
+++ b/Kernel/Panic.cpp
@@ -33,6 +33,8 @@ void __panic(const char* file, unsigned int line, const char* function)
critical_dmesgln("at {}:{} in {}", file, line, function);
dump_backtrace(PrintToScreen::Yes);
+ if (!CommandLine::was_initialized())
+ Processor::halt();
switch (kernel_command_line().panic_mode()) {
case PanicMode::Shutdown:
__shutdown();