From cd665ec172dadd049e7c1830b070f15b58fb9011 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Tue, 18 Aug 2026 13:51:55 +0200 Subject: kstd: flatten units namespace --- arch/x86_64/arch/bus/cpu.cpp | 2 +- arch/x86_64/arch/drivers/cpu/lapic.hpp | 2 +- arch/x86_64/arch/memory/kernel_mapper.cpp | 3 +-- arch/x86_64/arch/memory/page_table.hpp | 2 +- arch/x86_64/kapi/memory.cpp | 4 ++-- 5 files changed, 6 insertions(+), 7 deletions(-) (limited to 'arch/x86_64') diff --git a/arch/x86_64/arch/bus/cpu.cpp b/arch/x86_64/arch/bus/cpu.cpp index 0a0e94ec..4b9edffc 100644 --- a/arch/x86_64/arch/bus/cpu.cpp +++ b/arch/x86_64/arch/bus/cpu.cpp @@ -27,7 +27,7 @@ namespace arch::bus constexpr auto candidate_flags = ::acpi::processor_local_apic_entry::flags::processor_enabled // | ::acpi::processor_local_apic_entry::flags::online_capable; - constexpr auto lapic_mmio_range_size = kstd::units::bytes{0x400}; + constexpr auto lapic_mmio_range_size = kstd::bytes{0x400}; struct protocol final : kapi::devices::bus_protocol { diff --git a/arch/x86_64/arch/drivers/cpu/lapic.hpp b/arch/x86_64/arch/drivers/cpu/lapic.hpp index f2a8a4e9..678d364a 100644 --- a/arch/x86_64/arch/drivers/cpu/lapic.hpp +++ b/arch/x86_64/arch/drivers/cpu/lapic.hpp @@ -40,6 +40,6 @@ namespace arch::drivers::cpu bool m_is_mapped{}; }; -} // namespace arch::drivers +} // namespace arch::drivers::cpu #endif diff --git a/arch/x86_64/arch/memory/kernel_mapper.cpp b/arch/x86_64/arch/memory/kernel_mapper.cpp index 0ddf08dd..a15a1d9e 100644 --- a/arch/x86_64/arch/memory/kernel_mapper.cpp +++ b/arch/x86_64/arch/memory/kernel_mapper.cpp @@ -74,8 +74,7 @@ namespace arch::memory auto kernel_mapper::map_section(section_header_type const & section, std::string_view name, kapi::memory::page_mapper & mapper) -> void { - auto number_of_pages = - (kstd::units::bytes{section.size} + (kapi::memory::page::size - 1_B)) / kapi::memory::page::size; + auto number_of_pages = (kstd::bytes{section.size} + (kapi::memory::page::size - 1_B)) / kapi::memory::page::size; auto linear_start_address = kapi::memory::linear_address{section.virtual_load_address}; auto physical_start_address = kapi::memory::physical_address{section.virtual_load_address & ~m_kernel_load_base}; diff --git a/arch/x86_64/arch/memory/page_table.hpp b/arch/x86_64/arch/memory/page_table.hpp index 5bb4e1aa..12abacb5 100644 --- a/arch/x86_64/arch/memory/page_table.hpp +++ b/arch/x86_64/arch/memory/page_table.hpp @@ -117,7 +117,7 @@ namespace arch::memory }; //! The maximum number of entries in this table. - constexpr auto static entry_count{kapi::memory::page::size / kstd::units::bytes{sizeof(entry)}}; + constexpr auto static entry_count{kapi::memory::page::size / kstd::bytes{sizeof(entry)}}; //! Get the entry at the given index. //! diff --git a/arch/x86_64/kapi/memory.cpp b/arch/x86_64/kapi/memory.cpp index a6f84f07..37b4c7f3 100644 --- a/arch/x86_64/kapi/memory.cpp +++ b/arch/x86_64/kapi/memory.cpp @@ -129,7 +129,7 @@ namespace kapi::memory auto module_physical_start = physical_address{module.start_address}; auto module_virtual_start = linear_address{module.start_address + std::bit_cast(&arch::boot::TEACHOS_VMA)}; - auto module_size = static_cast(module.end_address - module.start_address); + auto module_size = static_cast(module.end_address - module.start_address); auto module_block_count = (module_size + frame::size - 1_B) / frame::size; for (auto i = 0uz; i < module_block_count; ++i) @@ -150,7 +150,7 @@ namespace kapi::memory })) { auto start = frame::containing(physical_address{region.base}); - auto count = kstd::units::bytes{region.size_in_B} / page::size; + auto count = kstd::bytes{region.size_in_B} / page::size; new_allocator.release_many({start, count}); } -- cgit v1.2.3