diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-07-24 23:12:23 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-07-24 23:12:23 +0200 |
| commit | 8ac3b7c5dfd6917eac1ffb117ee48231032ce754 (patch) | |
| tree | cd1203a908b6f449db2e321207b6e0e77962fa57 /arch | |
| parent | a1f1ddabf24fb6dfb1bcfc6257c44b6a2bfba8ab (diff) | |
| download | kernel-8ac3b7c5dfd6917eac1ffb117ee48231032ce754.tar.xz kernel-8ac3b7c5dfd6917eac1ffb117ee48231032ce754.zip | |
kernel: remove boot modules registry
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/x86_64/kapi/boot_modules.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/arch/x86_64/kapi/boot_modules.cpp b/arch/x86_64/kapi/boot_modules.cpp index 136eb30d..c86b9cf7 100644 --- a/arch/x86_64/kapi/boot_modules.cpp +++ b/arch/x86_64/kapi/boot_modules.cpp @@ -4,10 +4,12 @@ #include <arch/boot/ld.hpp> #include <kapi/boot.hpp> +#include <kapi/boot_modules/device.hpp> #include <kapi/boot_modules/module.hpp> -#include <kapi/boot_modules/registry.hpp> +#include <kapi/devices.hpp> #include <kapi/memory.hpp> +#include <kstd/memory.hpp> #include <kstd/print.hpp> #include <multiboot2/information.hpp> @@ -15,24 +17,27 @@ #include <algorithm> #include <bit> #include <cstdint> +#include <ranges> namespace kapi::boot_modules { - auto init() -> void + auto init(kapi::devices::bus & bus) -> void { - registry::init(); - - kstd::println("[x86_64:BOOT_MODULES] Registering boot modules."); + kstd::println("[x86_64:BOOT_MODULES] Attaching boot modules."); auto modules = boot::bootstrap_information.mbi->modules(); - std::ranges::for_each(modules, [](auto const & module) { - registry::get().add(kapi::boot_modules::module{ + + std::ranges::for_each(std::views::enumerate(modules), [&bus](auto entry) { + auto [index, module] = entry; + auto boot_module = kapi::boot_modules::module{ .name = module.string(), .start_address = memory::linear_address{module.start_address + std::bit_cast<std::uintptr_t>(&arch::boot::TEACHOS_VMA)}, - .size = module.end_address - module.start_address, - }); + .size = module.end_address - module.start_address}; + auto device = kstd::make_shared<kapi::boot_modules::device>(index, boot_module); + bus.add_child(device); }); } + } // namespace kapi::boot_modules
\ No newline at end of file |
