diff options
Diffstat (limited to 'kernel/kapi/boot_modules.cpp')
| -rw-r--r-- | kernel/kapi/boot_modules.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/kernel/kapi/boot_modules.cpp b/kernel/kapi/boot_modules.cpp index 3f0f044..5a0ef7f 100644 --- a/kernel/kapi/boot_modules.cpp +++ b/kernel/kapi/boot_modules.cpp @@ -7,15 +7,28 @@ namespace kapi::boot_modules { - constinit auto static registry = std::optional<kapi::boot_modules::boot_module_registry>{}; + namespace + { + constinit auto static registry = std::optional<kapi::boot_modules::boot_module_registry>{}; + } // namespace - auto set_boot_module_registry(boot_module_registry & registry) -> void + auto set_boot_module_registry(boot_module_registry & new_registry) -> void { - if (kapi::boot_modules::registry) + if (registry) { system::panic("[x86_64] Boot module registry has already been set."); } - kapi::boot_modules::registry = registry; + registry = new_registry; + } + + auto get_boot_module_registry() -> boot_module_registry & + { + if (!registry) + { + system::panic("[x86_64] Boot module registry has not been initialized."); + } + + return *registry; } } // namespace kapi::boot_modules |
