diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-07-28 13:09:08 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-07-28 13:09:08 +0200 |
| commit | 36248bb63a396dfea762d5b2cf028bf4b7a2b62e (patch) | |
| tree | b05726555a387b719292a4d19c4c4a5cbc7e31cc /arch/x86_64/kapi/devices.cpp | |
| parent | b5450cecbffdca1dd9dffdb58dd295a6a5d7f6eb (diff) | |
| download | kernel-36248bb63a396dfea762d5b2cf028bf4b7a2b62e.tar.xz kernel-36248bb63a396dfea762d5b2cf028bf4b7a2b62e.zip | |
x86_64: split lapic according to UDM
Diffstat (limited to 'arch/x86_64/kapi/devices.cpp')
| -rw-r--r-- | arch/x86_64/kapi/devices.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/arch/x86_64/kapi/devices.cpp b/arch/x86_64/kapi/devices.cpp index 748e0a6a..04b6fa2d 100644 --- a/arch/x86_64/kapi/devices.cpp +++ b/arch/x86_64/kapi/devices.cpp @@ -1,11 +1,21 @@ #include <kapi/devices.hpp> +#include <arch/bus/cpu.hpp> #include <arch/devices/init.hpp> #include <arch/drivers/init.hpp> +#include <kapi/system.hpp> + +#include <kstd/memory.hpp> + namespace kapi::devices { + namespace + { + auto static constinit cpu_bus = kstd::shared_ptr<arch::bus::cpu>{}; + } + auto init_platform_drivers() -> void { arch::drivers::init_legacy_drivers(); @@ -17,4 +27,25 @@ namespace kapi::devices arch::devices::init_legacy_devices(); } + auto get_cpu_bus() -> kstd::shared_ptr<bus> + { + if (!cpu_bus) + { + system::panic("[x86_64:DEV] The CPU topology has not yet been initialized!"); + } + + return cpu_bus; + } + + auto discover_cpu_topology() -> void + { + if (cpu_bus) + { + system::panic("[x86_64:DEV] The CPU topology has already been initialized!"); + } + + cpu_bus = kstd::make_shared<arch::bus::cpu>(); + cpu_bus->facet<kapi::devices::bus_protocol>()->enumerate(*cpu_bus); + } + } // namespace kapi::devices
\ No newline at end of file |
