mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-13 11:42:38 +03:00
Kernel: Ensure that CommandLine is initialized before choosing PanicMode
If the kernel commandline is not initialized, just halt everything.
This commit is contained in:
parent
0adee378fd
commit
d67c70d043
Notes:
sideshowbarker
2024-07-17 20:31:11 +09:00
Author: https://github.com/supercomputer7 Commit: https://github.com/SerenityOS/serenity/commit/d67c70d0435 Pull-request: https://github.com/SerenityOS/serenity/pull/12040 Reviewed-by: https://github.com/IdanHo
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user