From 36248bb63a396dfea762d5b2cf028bf4b7a2b62e Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Tue, 28 Jul 2026 13:09:08 +0200 Subject: x86_64: split lapic according to UDM --- kapi/kapi/cpu.hpp | 5 ----- kapi/kapi/devices.hpp | 12 ++++++++++-- kapi/kapi/devices/cpu.hpp | 35 ----------------------------------- 3 files changed, 10 insertions(+), 42 deletions(-) delete mode 100644 kapi/kapi/devices/cpu.hpp (limited to 'kapi') diff --git a/kapi/kapi/cpu.hpp b/kapi/kapi/cpu.hpp index 9a50f67e..7337a45a 100644 --- a/kapi/kapi/cpu.hpp +++ b/kapi/kapi/cpu.hpp @@ -101,11 +101,6 @@ namespace kapi::cpu //! interrupts itself. auto init() -> void; - //! Discover the CPU topology of the platform and attach it to the given CPU bus. - //! - //! @return true iff. the CPU topology was discovered successfully, false otherwise. - auto discover_topology() -> bool; - //! Get the current CPU id. //! //! @return The id of the CPU core currently executing the call to this function. diff --git a/kapi/kapi/devices.hpp b/kapi/kapi/devices.hpp index 8c0c238e..b20e3546 100644 --- a/kapi/kapi/devices.hpp +++ b/kapi/kapi/devices.hpp @@ -1,10 +1,8 @@ #ifndef TEACHOS_KAPI_DEVICES_HPP #define TEACHOS_KAPI_DEVICES_HPP -#include // IWYU pragma: export #include // IWYU pragma: export #include // IWYU pragma: export -#include // IWYU pragma: export #include // IWYU pragma: export #include // IWYU pragma: export #include // IWYU pragma: export @@ -75,6 +73,16 @@ namespace kapi::devices //! Initialize the platform's device tree. auto init_platform_devices() -> void; + //! Discover the platform's CPU topology + auto discover_cpu_topology() -> void; + + //! Get the virtual system CPU bus. + //! + //! @warning This function will panic if the CPU topology has not been discovered. + //! + //! @return a shared pointer to the CPU bus. + auto get_cpu_bus() -> kstd::shared_ptr; + //! @} } // namespace kapi::devices diff --git a/kapi/kapi/devices/cpu.hpp b/kapi/kapi/devices/cpu.hpp deleted file mode 100644 index 708c803e..00000000 --- a/kapi/kapi/devices/cpu.hpp +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef TEACHOS_KAPI_DEVICES_CPU_HPP -#define TEACHOS_KAPI_DEVICES_CPU_HPP - -#include - -#include - -namespace kapi::devices -{ - - //! A virtual CPU bus to host all CPUs in the system. - struct cpu final : kapi::devices::bus - { - //! A virtual CPU Core to host all core local devices. - struct core final : kapi::devices::bus - { - core(std::uint64_t index, std::uint64_t hardware_id, bool is_bsp); - - [[nodiscard]] auto hardware_id() const -> std::uint64_t; - [[nodiscard]] auto is_bsp() const -> bool; - [[nodiscard]] auto index() const noexcept -> std::uint64_t; - - private: - std::uint64_t m_index; - std::uint64_t m_hardware_id; - bool m_is_bsp; - }; - - //! Create a new CPU. - cpu(); - }; - -} // namespace kapi::devices - -#endif \ No newline at end of file -- cgit v1.2.3