From 159bdd2cac3f967c31c2f416fbc542e0277ec860 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Fri, 16 Jan 2026 13:55:51 +0100 Subject: kapi/system: introduce memory_initialized hook --- arch/x86_64/CMakeLists.txt | 1 + arch/x86_64/kapi/system.cpp | 14 ++++++++++++++ kapi/include/kapi/system.hpp | 4 ++++ kernel/src/main.cpp | 1 + 4 files changed, 20 insertions(+) create mode 100644 arch/x86_64/kapi/system.cpp diff --git a/arch/x86_64/CMakeLists.txt b/arch/x86_64/CMakeLists.txt index 413b5aa..9ea10e9 100644 --- a/arch/x86_64/CMakeLists.txt +++ b/arch/x86_64/CMakeLists.txt @@ -15,6 +15,7 @@ target_sources("x86_64" PRIVATE "kapi/cio.cpp" "kapi/cpu.cpp" "kapi/memory.cpp" + "kapi/system.cpp" # Low-level bootstrap "src/boot/boot32.S" diff --git a/arch/x86_64/kapi/system.cpp b/arch/x86_64/kapi/system.cpp new file mode 100644 index 0000000..5bcae4d --- /dev/null +++ b/arch/x86_64/kapi/system.cpp @@ -0,0 +1,14 @@ +#include "kapi/system.hpp" + +#include + +namespace kapi::system +{ + + auto memory_initialized() -> void + { + kstd::println("[x86_64:SYS] TODO: initialize Interrupt Descriptor Table."); + kstd::println("[x86_64:SYS] TODO: reload Global Descriptor Table."); + } + +} // namespace kapi::system \ No newline at end of file diff --git a/kapi/include/kapi/system.hpp b/kapi/include/kapi/system.hpp index 6c5683a..e5c43c5 100644 --- a/kapi/include/kapi/system.hpp +++ b/kapi/include/kapi/system.hpp @@ -15,6 +15,10 @@ namespace kapi::system //! @param message The message associated with the panic [[noreturn]] auto panic(std::string_view message, std::source_location = std::source_location::current()) -> void; + //! @qualifier platform-defined + //! A hook that runs once the memory subsystem has been initialized. + auto memory_initialized() -> void; + } // namespace kapi::system #endif diff --git a/kernel/src/main.cpp b/kernel/src/main.cpp index 8732fa2..d69903d 100644 --- a/kernel/src/main.cpp +++ b/kernel/src/main.cpp @@ -11,6 +11,7 @@ auto main() -> int kapi::memory::init(); kstd::println("[OS] Memory subsystem initialized."); + kapi::system::memory_initialized(); kapi::system::panic("Returning from kernel main!"); } -- cgit v1.2.3