mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:37:45 +00:00
Kernel: Separate panic behavior from bootmode
Bootmode used to control panic behavior and SystemServer. This patch factors panic behavior control into a separate flag.
This commit is contained in:
parent
542a88a7be
commit
09432a8241
8 changed files with 37 additions and 6 deletions
|
@ -38,8 +38,9 @@ UNMAP_AFTER_INIT void CommandLine::initialize()
|
|||
VERIFY(!s_the);
|
||||
s_the = new CommandLine(s_cmd_line);
|
||||
dmesgln("Kernel Commandline: {}", kernel_command_line().string());
|
||||
// Validate the boot mode the user passed in.
|
||||
// Validate the modes the user passed in.
|
||||
(void)s_the->boot_mode(Validate::Yes);
|
||||
(void)s_the->panic_mode(Validate::Yes);
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT void CommandLine::build_commandline(const String& cmdline_from_bootloader)
|
||||
|
@ -214,6 +215,21 @@ BootMode CommandLine::boot_mode(Validate should_validate) const
|
|||
return BootMode::Unknown;
|
||||
}
|
||||
|
||||
PanicMode CommandLine::panic_mode(Validate should_validate) const
|
||||
{
|
||||
const auto panic_mode = lookup("panic"sv).value_or("halt"sv);
|
||||
if (panic_mode == "halt"sv) {
|
||||
return PanicMode::Halt;
|
||||
} else if (panic_mode == "shutdown"sv) {
|
||||
return PanicMode::Shutdown;
|
||||
}
|
||||
|
||||
if (should_validate == Validate::Yes)
|
||||
PANIC("Unknown PanicMode: {}", panic_mode);
|
||||
|
||||
return PanicMode::Halt;
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT bool CommandLine::are_framebuffer_devices_enabled() const
|
||||
{
|
||||
return lookup("fbdev"sv).value_or("on"sv) == "on"sv;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue