diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2021-05-31 01:51:09 -0700 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-05-31 14:50:49 +0430 |
commit | d838a02e74ffd6af59ce7c27971fb193491a492c (patch) | |
tree | 5e8d548e414a42a786fad19b4cbf513e1757c861 /Kernel/init.cpp | |
parent | de0aa44bb66241be8a71843471fef12dac9e9673 (diff) | |
download | serenity-d838a02e74ffd6af59ce7c27971fb193491a492c.zip |
Kernel: Add KString::must_{..} factory methods
There are a bunch of places like drivers which for all intense and
purposes can't really fail allocation during boot, and if they do
fail we should crash immediately.
This change adds `KString::must_create_uninitialized(..)` as well as
`KString::must_create(..)` for use during early boot initialization of
the Kernel. They enforce that they are only used during early boot.
Diffstat (limited to 'Kernel/init.cpp')
-rw-r--r-- | Kernel/init.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Kernel/init.cpp b/Kernel/init.cpp index 8be6e2d266..df56ae26e7 100644 --- a/Kernel/init.cpp +++ b/Kernel/init.cpp @@ -78,6 +78,7 @@ multiboot_module_entry_t multiboot_copy_boot_modules_array[16]; size_t multiboot_copy_boot_modules_count; extern "C" const char kernel_cmdline[4096]; +bool g_in_early_boot; namespace Kernel { @@ -111,6 +112,7 @@ extern "C" UNMAP_AFTER_INIT [[noreturn]] void init() asm volatile("cli;hlt"); } + g_in_early_boot = true; setup_serial_debug(); // We need to copy the command line before kmalloc is initialized, @@ -271,6 +273,9 @@ void init_stage2(void*) // NOTE: Everything marked UNMAP_AFTER_INIT becomes inaccessible after this point. MM.unmap_memory_after_init(); + // Switch out of early boot mode. + g_in_early_boot = false; + int error; // FIXME: It would be nicer to set the mode from userspace. |