aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorLukas Oesch <lukasoesch20@gmail.com>2026-02-26 11:24:27 +0100
committerLukas Oesch <lukasoesch20@gmail.com>2026-03-17 16:42:10 +0100
commit035c8d6e38fd901e6769a81f67b8d9e1e3fcea20 (patch)
tree5ca549e23b86529fa65045e2f63cdc8411e165ba /kernel
parentea8172296fa5b56137f97c01650b8d392bdb897f (diff)
downloadteachos-035c8d6e38fd901e6769a81f67b8d9e1e3fcea20.tar.xz
teachos-035c8d6e38fd901e6769a81f67b8d9e1e3fcea20.zip
implemented boot_modules and boot_module_registry, init boot_modules in kernel main
Diffstat (limited to 'kernel')
-rw-r--r--kernel/CMakeLists.txt1
-rw-r--r--kernel/kapi/boot_modules.cpp21
-rw-r--r--kernel/src/main.cpp4
3 files changed, 26 insertions, 0 deletions
diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt
index 02e517c..b7b7c71 100644
--- a/kernel/CMakeLists.txt
+++ b/kernel/CMakeLists.txt
@@ -1,5 +1,6 @@
add_executable("kernel"
# Platform-independent KAPI implementation
+ "kapi/boot_modules.cpp"
"kapi/cio.cpp"
"kapi/memory.cpp"
"kapi/system.cpp"
diff --git a/kernel/kapi/boot_modules.cpp b/kernel/kapi/boot_modules.cpp
new file mode 100644
index 0000000..3f0f044
--- /dev/null
+++ b/kernel/kapi/boot_modules.cpp
@@ -0,0 +1,21 @@
+#include "kapi/boot_modules.hpp"
+
+#include "kapi/system.hpp"
+
+#include <optional>
+
+namespace kapi::boot_modules
+{
+
+ constinit auto static registry = std::optional<kapi::boot_modules::boot_module_registry>{};
+
+ auto set_boot_module_registry(boot_module_registry & registry) -> void
+ {
+ if (kapi::boot_modules::registry)
+ {
+ system::panic("[x86_64] Boot module registry has already been set.");
+ }
+
+ kapi::boot_modules::registry = registry;
+ }
+} // namespace kapi::boot_modules
diff --git a/kernel/src/main.cpp b/kernel/src/main.cpp
index 01bcbb0..117a1d8 100644
--- a/kernel/src/main.cpp
+++ b/kernel/src/main.cpp
@@ -1,3 +1,4 @@
+#include "kapi/boot_modules.hpp"
#include "kapi/cio.hpp"
#include "kapi/memory.hpp"
#include "kapi/system.hpp"
@@ -16,5 +17,8 @@ auto main() -> int
kstd::println("[OS] Memory subsystem initialized.");
kapi::system::memory_initialized();
+ kapi::boot_modules::init();
+ kstd::println("[OS] Boot module registry initialized.");
+
kapi::system::panic("Returning from kernel main!");
}