diff options
| author | Lukas Oesch <lukasoesch20@gmail.com> | 2026-02-27 23:23:18 +0100 |
|---|---|---|
| committer | Lukas Oesch <lukasoesch20@gmail.com> | 2026-03-17 16:42:15 +0100 |
| commit | 296d58550e8e1202d83e66034c24e9454a1b67dc (patch) | |
| tree | 655d63a267a4c05acf4c5add5e44541983f200ab /kernel/kapi | |
| parent | e84c7fbf336847d3ff62aac10ed8f6d04a06cbe8 (diff) | |
| download | teachos-296d58550e8e1202d83e66034c24e9454a1b67dc.tar.xz teachos-296d58550e8e1202d83e66034c24e9454a1b67dc.zip | |
- add boot_module_registry getter
Diffstat (limited to 'kernel/kapi')
| -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 |
