mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:37:37 +00:00
Kernel: Fix panic loop when encountering an unknown boot_mode
The kernel panic handler now parses the kernels boot_mode to decide how to handle the panic. So the previous logic could end up in an panic loop until we blew out the kernel stack. Instead only validate the kernel's boot mode once per boot, after initializing the kernel command line.
This commit is contained in:
parent
312946059b
commit
8e93815846
2 changed files with 15 additions and 4 deletions
|
@ -38,6 +38,8 @@ 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.
|
||||
(void)s_the->boot_mode(Validate::Yes);
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT void CommandLine::build_commandline(const String& cmdline_from_bootloader)
|
||||
|
@ -191,7 +193,7 @@ UNMAP_AFTER_INIT AHCIResetMode CommandLine::ahci_reset_mode() const
|
|||
PANIC("Unknown AHCIResetMode: {}", ahci_reset_mode);
|
||||
}
|
||||
|
||||
BootMode CommandLine::boot_mode() const
|
||||
BootMode CommandLine::boot_mode(Validate should_validate) const
|
||||
{
|
||||
const auto boot_mode = lookup("boot_mode"sv).value_or("graphical"sv);
|
||||
if (boot_mode == "no-fbdev"sv) {
|
||||
|
@ -201,7 +203,10 @@ BootMode CommandLine::boot_mode() const
|
|||
} else if (boot_mode == "graphical"sv) {
|
||||
return BootMode::Graphical;
|
||||
}
|
||||
PANIC("Unknown BootMode: {}", boot_mode);
|
||||
|
||||
if (should_validate == Validate::Yes)
|
||||
PANIC("Unknown BootMode: {}", boot_mode);
|
||||
return BootMode::Unknown;
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT bool CommandLine::is_no_framebuffer_devices_mode() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue