From 1f8cc6683f4e2ef2e311078f48a1b4477dadaaec Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Tue, 17 Mar 2026 22:21:33 +0100 Subject: x86_64/memory: fix region allocator logic --- arch/x86_64/src/memory/region_allocator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86_64/src/memory/region_allocator.cpp b/arch/x86_64/src/memory/region_allocator.cpp index 2690a7c..4ee3ca4 100644 --- a/arch/x86_64/src/memory/region_allocator.cpp +++ b/arch/x86_64/src/memory/region_allocator.cpp @@ -85,14 +85,14 @@ namespace arch::memory { m_next_frame = m_kernel_end + 1; advanced = true; - break; + continue; } if (falls_within(m_next_frame, m_multiboot_start, m_multiboot_end)) { m_next_frame = m_multiboot_end + 1; advanced = true; - break; + continue; } if (m_multiboot_information) -- cgit v1.2.3 From 9ad3eafdfa46dc01d7a8737a59fe59caffd91d67 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Tue, 17 Mar 2026 22:22:29 +0100 Subject: kstd: fix constructor selection in vector The old version would lead to potential issues, since an explicit ctor may get selected. Ideally vector should be adapted to not allocated an array of it's value type but simply suitably aligned raw storage. --- libs/kstd/include/kstd/vector | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/kstd/include/kstd/vector b/libs/kstd/include/kstd/vector index 7568cb6..41b380e 100644 --- a/libs/kstd/include/kstd/vector +++ b/libs/kstd/include/kstd/vector @@ -85,7 +85,7 @@ namespace kstd vector(vector const & other) : _size(other._size) , _capacity(other._capacity) - , _data(new value_type[_capacity]{}) + , _data(new value_type[_capacity]()) { std::ranges::copy(other, _data); } @@ -104,7 +104,7 @@ namespace kstd delete[] _data; _size = other._size; _capacity = other._capacity; - _data = new value_type[_capacity]{}; + _data = new value_type[_capacity](); std::ranges::copy(other, _data); return *this; } @@ -490,7 +490,7 @@ namespace kstd } _capacity = new_capacity; - auto temp = new value_type[_capacity]{}; + auto temp = new value_type[_capacity](); std::ranges::copy(begin(), end(), temp); delete[] _data; _data = temp; -- cgit v1.2.3 From 044a64ef019ce2ff241e72f2b7b3a444b922b798 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Tue, 17 Mar 2026 22:31:40 +0100 Subject: kstd: add more nodiscard to shared_ptr --- libs/kstd/include/kstd/bits/shared_ptr.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libs/kstd/include/kstd/bits/shared_ptr.hpp b/libs/kstd/include/kstd/bits/shared_ptr.hpp index ed23d29..6bce83f 100644 --- a/libs/kstd/include/kstd/bits/shared_ptr.hpp +++ b/libs/kstd/include/kstd/bits/shared_ptr.hpp @@ -250,7 +250,7 @@ namespace kstd * * @return Returns the object owned by *this, equivalent to *get(). */ - auto operator*() const -> T & + [[nodiscard]] auto operator*() const -> T & { return *pointer; } @@ -260,7 +260,7 @@ namespace kstd * * @return Returns a pointer to the object owned by *this, i.e. get(). */ - auto operator->() const -> T * + [[nodiscard]] auto operator->() const -> T * { return pointer; } @@ -270,7 +270,7 @@ namespace kstd * * @return Pointer to the managed object or nullptr if no object is owned. */ - auto get() const -> T * + [[nodiscard]] auto get() const -> T * { return pointer; } @@ -301,7 +301,7 @@ namespace kstd * * @return true if *this owns an object, false otherwise. */ - explicit operator bool() const + [[nodiscard]] explicit operator bool() const { return pointer != nullptr; } @@ -317,7 +317,7 @@ namespace kstd /** * @brief Compare nullptr with shared_ptr. */ - friend auto operator==(std::nullptr_t, shared_ptr const & ptr) -> bool + [[nodiscard]] friend auto operator==(std::nullptr_t, shared_ptr const & ptr) -> bool { return ptr.pointer == nullptr; } @@ -325,7 +325,7 @@ namespace kstd /** * @brief Defaulted three-way comparator operator. */ - auto operator<=>(shared_ptr const & other) const = default; + [[nodiscard]] auto operator<=>(shared_ptr const & other) const = default; private: /** -- cgit v1.2.3 From 483b7789c38e42b26fbdbf10601fe47567078a50 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Tue, 17 Mar 2026 22:32:06 +0100 Subject: kapi/memory: remove penalizing explicit --- kapi/include/kapi/memory/address.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kapi/include/kapi/memory/address.hpp b/kapi/include/kapi/memory/address.hpp index 3bef358..69fc7b9 100644 --- a/kapi/include/kapi/memory/address.hpp +++ b/kapi/include/kapi/memory/address.hpp @@ -33,7 +33,7 @@ namespace kapi::memory struct address { //! Construct a null-address. - constexpr explicit address() noexcept = default; + constexpr address() noexcept = default; //! Construct an address representing the given value. //! -- cgit v1.2.3 From d2e7a4e2fd5a2973b6c9071951eaf8b2d24d84a3 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Tue, 17 Mar 2026 22:32:52 +0100 Subject: kapi/bootm: initialize all members --- kapi/include/kapi/boot_module/boot_module.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kapi/include/kapi/boot_module/boot_module.hpp b/kapi/include/kapi/boot_module/boot_module.hpp index 729efc9..85a1ac5 100644 --- a/kapi/include/kapi/boot_module/boot_module.hpp +++ b/kapi/include/kapi/boot_module/boot_module.hpp @@ -14,9 +14,9 @@ namespace kapi::boot_modules // ! its name, virtual start address, and size. struct boot_module { - std::string_view name; + std::string_view name{}; memory::linear_address start_address{}; - size_t size; + std::size_t size{}; }; } // namespace kapi::boot_modules -- cgit v1.2.3