From 43ab7852a4f27a249ea7cd5760683ffe0623c44c Mon Sep 17 00:00:00 2001 From: Mazunki Hoksaas Date: Tue, 28 Oct 2025 17:04:06 +0100 Subject: [PATCH 1/4] give allocators their own location --- api/hal/machine.hpp | 2 +- api/hal/machine_memory.hpp | 2 +- api/kernel/memory.hpp | 4 ++-- api/{util/alloc_buddy.hpp => mem/alloc/buddy.hpp} | 0 api/{util/alloc_lstack.hpp => mem/alloc/lstack.hpp} | 0 api/{util/alloc_pmr.hpp => mem/alloc/pmr.hpp} | 0 api/{util => mem}/allocator.hpp | 0 api/net/tcp/connection.hpp | 2 +- api/net/tcp/tcp.hpp | 2 +- src/musl/mmap.cpp | 2 +- src/util/pmr_default.cpp | 2 +- test/unit/memory/alloc/buddy_alloc_test.cpp | 4 ++-- test/unit/memory/alloc/pmr_alloc_test.cpp | 2 +- test/unit/memory/lstack/test_lstack.hpp | 2 +- 14 files changed, 12 insertions(+), 12 deletions(-) rename api/{util/alloc_buddy.hpp => mem/alloc/buddy.hpp} (100%) rename api/{util/alloc_lstack.hpp => mem/alloc/lstack.hpp} (100%) rename api/{util/alloc_pmr.hpp => mem/alloc/pmr.hpp} (100%) rename api/{util => mem}/allocator.hpp (100%) diff --git a/api/hal/machine.hpp b/api/hal/machine.hpp index 3f9a920991..87653be4a5 100644 --- a/api/hal/machine.hpp +++ b/api/hal/machine.hpp @@ -21,7 +21,7 @@ #include #include -#include +#include namespace os { namespace detail { class Machine; } diff --git a/api/hal/machine_memory.hpp b/api/hal/machine_memory.hpp index 951b9567d5..eec08f2008 100644 --- a/api/hal/machine_memory.hpp +++ b/api/hal/machine_memory.hpp @@ -15,7 +15,7 @@ // limitations under the License. #include -#include +#include #ifndef OS_MACHINE_MEMORY_HPP #define OS_MACHINE_MEMORY_HPP diff --git a/api/kernel/memory.hpp b/api/kernel/memory.hpp index c19480b4c1..46d8641cc7 100644 --- a/api/kernel/memory.hpp +++ b/api/kernel/memory.hpp @@ -21,8 +21,8 @@ #include #include -#include -#include +#include +#include #include #include #include diff --git a/api/util/alloc_buddy.hpp b/api/mem/alloc/buddy.hpp similarity index 100% rename from api/util/alloc_buddy.hpp rename to api/mem/alloc/buddy.hpp diff --git a/api/util/alloc_lstack.hpp b/api/mem/alloc/lstack.hpp similarity index 100% rename from api/util/alloc_lstack.hpp rename to api/mem/alloc/lstack.hpp diff --git a/api/util/alloc_pmr.hpp b/api/mem/alloc/pmr.hpp similarity index 100% rename from api/util/alloc_pmr.hpp rename to api/mem/alloc/pmr.hpp diff --git a/api/util/allocator.hpp b/api/mem/allocator.hpp similarity index 100% rename from api/util/allocator.hpp rename to api/mem/allocator.hpp diff --git a/api/net/tcp/connection.hpp b/api/net/tcp/connection.hpp index a6c35cfeaa..846216a243 100644 --- a/api/net/tcp/connection.hpp +++ b/api/net/tcp/connection.hpp @@ -31,7 +31,7 @@ #include #include -#include +#include namespace net { // Forward declaration of the TCP object diff --git a/api/net/tcp/tcp.hpp b/api/net/tcp/tcp.hpp index a3072857a3..2ee67a9b42 100644 --- a/api/net/tcp/tcp.hpp +++ b/api/net/tcp/tcp.hpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include namespace net { diff --git a/src/musl/mmap.cpp b/src/musl/mmap.cpp index 691681691c..d218324948 100644 --- a/src/musl/mmap.cpp +++ b/src/musl/mmap.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/util/pmr_default.cpp b/src/util/pmr_default.cpp index cc7fc7f4e4..7caafecb39 100644 --- a/src/util/pmr_default.cpp +++ b/src/util/pmr_default.cpp @@ -1,5 +1,5 @@ -#include +#include std::pmr::memory_resource* std::pmr::get_default_resource() noexcept { static os::mem::Default_pmr* default_pmr; diff --git a/test/unit/memory/alloc/buddy_alloc_test.cpp b/test/unit/memory/alloc/buddy_alloc_test.cpp index cdac74d4aa..2d47f4849b 100644 --- a/test/unit/memory/alloc/buddy_alloc_test.cpp +++ b/test/unit/memory/alloc/buddy_alloc_test.cpp @@ -17,8 +17,8 @@ // #define DEBUG_UNIT #include -#include -#include +#include +#include #include struct Pool { diff --git a/test/unit/memory/alloc/pmr_alloc_test.cpp b/test/unit/memory/alloc/pmr_alloc_test.cpp index 97b43a0358..1d3cd39a0d 100644 --- a/test/unit/memory/alloc/pmr_alloc_test.cpp +++ b/test/unit/memory/alloc/pmr_alloc_test.cpp @@ -17,7 +17,7 @@ #define DEBUG_UNIT #include -#include +#include #include #if __has_include() diff --git a/test/unit/memory/lstack/test_lstack.hpp b/test/unit/memory/lstack/test_lstack.hpp index 8d5dd2f6f4..519d1f6d57 100644 --- a/test/unit/memory/lstack/test_lstack.hpp +++ b/test/unit/memory/lstack/test_lstack.hpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include From 116b4f54dddaa6c7ea912f767904eb0ee817fc99 Mon Sep 17 00:00:00 2001 From: Mazunki Hoksaas Date: Tue, 28 Oct 2025 18:10:37 +0100 Subject: [PATCH 2/4] unite files into matching namespace --- api/{kernel => mem}/memmap.hpp | 6 +++--- api/{kernel => mem}/memory.hpp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) rename api/{kernel => mem}/memmap.hpp (99%) rename api/{kernel => mem}/memory.hpp (98%) diff --git a/api/kernel/memmap.hpp b/api/mem/memmap.hpp similarity index 99% rename from api/kernel/memmap.hpp rename to api/mem/memmap.hpp index 1009c2388f..917db58fef 100644 --- a/api/kernel/memmap.hpp +++ b/api/mem/memmap.hpp @@ -16,8 +16,8 @@ // limitations under the License. #pragma once -#ifndef KERNEL_MEMMAP_HPP -#define KERNEL_MEMMAP_HPP +#ifndef MEM_MEMMAP_HPP +#define MEM_MEMMAP_HPP #include #include @@ -466,4 +466,4 @@ class Memory_map { }; //< class Memory_map } // ns os::mem -#endif //< KERNEL_MEMMAP_HPP +#endif //< MEM_MEMMAP_HPP diff --git a/api/kernel/memory.hpp b/api/mem/memory.hpp similarity index 98% rename from api/kernel/memory.hpp rename to api/mem/memory.hpp index 46d8641cc7..194a649008 100644 --- a/api/kernel/memory.hpp +++ b/api/mem/memory.hpp @@ -16,8 +16,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef KERNEL_MEMORY_HPP -#define KERNEL_MEMORY_HPP +#ifndef MEM_MEMORY_HPP +#define MEM_MEMORY_HPP #include #include @@ -25,7 +25,7 @@ #include #include #include -#include +#include namespace os::mem { @@ -342,4 +342,4 @@ namespace os::mem { } -#endif +#endif // MEM_MEMORY_HPP From 9efbce80a3095e48f53bf9ce255166e112b9364a Mon Sep 17 00:00:00 2001 From: Mazunki Hoksaas Date: Tue, 28 Oct 2025 18:19:40 +0100 Subject: [PATCH 3/4] modularize protection flags into dedicated file --- api/mem/flags.hpp | 26 ++++++++++++++++++++++++++ api/mem/memory.hpp | 20 +------------------- 2 files changed, 27 insertions(+), 19 deletions(-) create mode 100644 api/mem/flags.hpp diff --git a/api/mem/flags.hpp b/api/mem/flags.hpp new file mode 100644 index 0000000000..fef1973f7d --- /dev/null +++ b/api/mem/flags.hpp @@ -0,0 +1,26 @@ +#ifndef MEM_FLAGS_HPP +#define MEM_FLAGS_HPP + +#include +#include + +namespace os::mem { + enum class Access : uint8_t { + none = 0, + read = 1, + write = 2, + execute = 4 + }; +} // os::mem + +namespace util { + inline namespace bitops { + template<> + struct enable_bitmask_ops { + using type = typename std::underlying_type::type; + static constexpr bool enable = true; + }; + } +} + +#endif // MEM_FLAGS_HPP diff --git a/api/mem/memory.hpp b/api/mem/memory.hpp index 194a649008..a83ed95823 100644 --- a/api/mem/memory.hpp +++ b/api/mem/memory.hpp @@ -23,20 +23,13 @@ #include #include #include +#include #include #include #include namespace os::mem { - /** POSIX mprotect compliant access bits **/ - enum class Access : uint8_t { - none = 0, - read = 1, - write = 2, - execute = 4 - }; - using Raw_allocator = buddy::Alloc; /** Get default allocator for untyped allocations */ @@ -178,17 +171,6 @@ namespace os::mem { -// Enable bitwise ops on access flags -namespace util { -inline namespace bitops { - template<> - struct enable_bitmask_ops { - using type = typename std::underlying_type::type; - static constexpr bool enable = true; - }; -} -} - namespace os::mem { From 7d0a670274939fa935613e41c7e0971071f84a81 Mon Sep 17 00:00:00 2001 From: Mazunki Hoksaas Date: Tue, 28 Oct 2025 19:15:39 +0100 Subject: [PATCH 4/4] segregate virtual page mapping from conceptual allocations --- api/arch/x86/paging.hpp | 2 +- api/mem/alloc.hpp | 28 +++ api/mem/{memory.hpp => vmap.hpp} | 207 ++++++++------------- api/util/typename.hpp | 2 +- lib/LiveUpdate/src/os.cpp | 2 +- lib/LiveUpdate/src/storage.cpp | 2 +- lib/LiveUpdate/src/update.cpp | 1 - src/arch/aarch64/paging.cpp | 3 +- src/arch/i686/paging.cpp | 2 +- src/arch/x86_64/ist.cpp | 2 +- src/kernel/elf.cpp | 3 +- src/kernel/liveupdate.cpp | 2 +- src/kernel/memmap.cpp | 2 +- src/kernel/multiboot.cpp | 2 +- src/kernel/system_log.cpp | 2 +- src/musl/mlock.cpp | 1 - src/musl/mmap.cpp | 2 +- src/musl/mprotect.cpp | 1 - src/net/buffer_store.cpp | 2 +- src/platform/x86_pc/idt.cpp | 2 +- src/platform/x86_pc/os.cpp | 2 +- src/platform/x86_pc/softreset.cpp | 1 - src/posix/memalign.cpp | 2 +- test/integration/kernel/memmap/service.cpp | 2 +- test/integration/memory/paging/service.cpp | 2 +- test/unit/kernel/os_test.cpp | 2 +- test/unit/memory/generic/test_memory.cpp | 2 +- test/unit/memory/mapping/memmap_test.cpp | 2 +- test/unit/memory/paging/x86_paging.cpp | 2 +- 29 files changed, 128 insertions(+), 159 deletions(-) create mode 100644 api/mem/alloc.hpp rename api/mem/{memory.hpp => vmap.hpp} (64%) diff --git a/api/arch/x86/paging.hpp b/api/arch/x86/paging.hpp index 2fa2fe7847..15eb01aa47 100644 --- a/api/arch/x86/paging.hpp +++ b/api/arch/x86/paging.hpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include diff --git a/api/mem/alloc.hpp b/api/mem/alloc.hpp new file mode 100644 index 0000000000..aa41868141 --- /dev/null +++ b/api/mem/alloc.hpp @@ -0,0 +1,28 @@ +#ifndef MEM_ALLOC_HPP +#define MEM_ALLOC_HPP + +#include +#include + +namespace os::mem { + + using Raw_allocator = buddy::Alloc; + + /** Get default allocator for untyped allocations */ + Raw_allocator& raw_allocator(); + + template + using Typed_allocator = Allocator; + + /** Get default std::allocator for typed allocations */ + template + inline Typed_allocator system_allocator() { + return Typed_allocator(raw_allocator()); + } + + /** True once the heap is initialized and usable */ + bool heap_ready(); + +} // namespace os::mem + +#endif // MEM_ALLOC_HPP diff --git a/api/mem/memory.hpp b/api/mem/vmap.hpp similarity index 64% rename from api/mem/memory.hpp rename to api/mem/vmap.hpp index a83ed95823..2fe6ee7fba 100644 --- a/api/mem/memory.hpp +++ b/api/mem/vmap.hpp @@ -1,47 +1,18 @@ -// -*- C++ -*- -// This file is a part of the IncludeOS unikernel - www.includeos.org -// -// Copyright 2017 Oslo and Akershus University College of Applied Sciences -// and Alfred Bratterud -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef MEM_MEMORY_HPP -#define MEM_MEMORY_HPP +#ifndef MEM_VMAP_HPP +#define MEM_VMAP_HPP #include #include -#include -#include #include -#include -#include #include +#include +#include +#include +#include +#include namespace os::mem { - using Raw_allocator = buddy::Alloc; - - /** Get default allocator for untyped allocations */ - Raw_allocator& raw_allocator(); - - template - using Typed_allocator = Allocator; - - /** Get default std::allocator for typed allocations */ - template - Typed_allocator system_allocator() { return Typed_allocator(raw_allocator()); } - /** Get bitfield with bit set for each supported page size */ uintptr_t supported_page_sizes(); @@ -62,15 +33,14 @@ namespace os::mem { * For interfacing with the virtual memory API, e.g. mem::map / mem::protect. **/ template - struct Mapping - { + struct Mapping { static const size_t any_size; uintptr_t lin = 0; uintptr_t phys = 0; - Fl flags {}; - size_t size = 0; - size_t page_sizes = 0; + Fl flags {}; + size_t size = 0; + size_t page_sizes = 0; // Constructors Mapping() = default; @@ -94,15 +64,13 @@ namespace os::mem { inline size_t max_psize() const noexcept; std::string to_string() const; - - }; // struct Mapping<> + }; using Map = Mapping<>; /** Exception class possibly used by various ::mem functions. **/ class Memory_exception : public std::runtime_error - { using runtime_error::runtime_error; }; - + { using std::runtime_error::runtime_error; }; /** * Map linear address to physical memory, according to provided Mapping. @@ -123,7 +91,9 @@ namespace os::mem { /** Determine active page size of a given linear address **/ uintptr_t active_page_size(uintptr_t addr); - uintptr_t active_page_size(void* addr); + inline uintptr_t active_page_size(void* addr) { + return active_page_size((uintptr_t) addr); + } /** * Set and return access flags for a given linear address range. @@ -150,81 +120,70 @@ namespace os::mem { **/ Access protect_page(uintptr_t linear, Access flags = Access::read); - /** Get the physical address to which linear address is mapped **/ uintptr_t virt_to_phys(uintptr_t linear); - void virtual_move(uintptr_t src, size_t size, uintptr_t dst, const char* label); + inline void virtual_move(uintptr_t src, size_t size, uintptr_t dst, const char* label) + { + using namespace util::bitops; + const auto flags = os::mem::Access::read | os::mem::Access::write; + // setup @dst as new virt area for @src + os::mem::map({dst, src, flags, size}, label); + // unpresent @src + os::mem::protect(src, size, os::mem::Access::none); + } /** Virtual memory map **/ inline Memory_map& vmmap() { // TODO Move to machine static Memory_map memmap; return memmap; - }; - - bool heap_ready(); - -} // os::mem - - - - + } -namespace os::mem { // - // mem::Mapping implementation + // Mapping implementation // - template - Mapping::Mapping(uintptr_t linear, uintptr_t physical, Fl fl, size_t sz) - : lin{linear}, phys{physical}, flags{fl}, size{sz}, - page_sizes{any_size} {} + inline Mapping::Mapping(uintptr_t linear, uintptr_t physical, Fl fl, size_t sz) + : lin{linear}, phys{physical}, flags{fl}, size{sz}, page_sizes{any_size} {} template - Mapping::Mapping(uintptr_t linear, uintptr_t physical, Fl fl, size_t sz, size_t psz) - : lin{linear}, phys{physical}, flags{fl}, size{sz}, page_sizes{psz} - {} + inline Mapping::Mapping(uintptr_t linear, uintptr_t physical, Fl fl, size_t sz, size_t psz) + : lin{linear}, phys{physical}, flags{fl}, size{sz}, page_sizes{psz} {} template - bool Mapping::operator==(const Mapping& rhs) const noexcept - { return lin == rhs.lin - && phys == rhs.phys - && flags == rhs.flags - && size == rhs.size - && page_sizes == rhs.page_sizes; } + inline bool Mapping::operator==(const Mapping& rhs) const noexcept { + return lin == rhs.lin + && phys == rhs.phys + && flags == rhs.flags + && size == rhs.size + && page_sizes == rhs.page_sizes; + } template - Mapping::operator bool() const noexcept - { return size != 0 && page_sizes !=0; } + inline Mapping::operator bool() const noexcept { + return size != 0 && page_sizes != 0; + } template - bool Mapping::operator!=(const Mapping& rhs) const noexcept - { return ! (*this == rhs); } + inline bool Mapping::operator!=(const Mapping& rhs) const noexcept { + return !(*this == rhs); + } template - Mapping Mapping::operator+(const Mapping& rhs) noexcept - { + inline Mapping Mapping::operator+(const Mapping& rhs) noexcept { using namespace util::bitops; Mapping res; // Adding with empty map behaves like 0 + x / x + 0. - if (! rhs) { - return *this; - } - - if (! *this) - return rhs; - - if (res == rhs) - return res; + if (not rhs) return *this; + if (not *this) return rhs; + if (res == rhs) return res; // The mappings must have connecting ranges - if ((rhs.lin + rhs.size != lin) - and lin + size != rhs.lin) - { + if ((rhs.lin + rhs.size != lin) and (lin + size != rhs.lin)) { Ensures(!res); return res; } @@ -235,37 +194,35 @@ namespace os::mem { // The mappings can span several page sizes res.page_sizes |= rhs.page_sizes; - if (page_sizes && page_sizes != rhs.page_sizes) - { + if (page_sizes && page_sizes != rhs.page_sizes) { res.page_sizes |= page_sizes; } - res.size = size + rhs.size; + res.size = size + rhs.size; res.flags = flags & rhs.flags; - if (rhs) - Ensures(res); - + if (rhs) Ensures(res); return res; } template - Mapping Mapping::operator+=(const Mapping& rhs) noexcept { + inline Mapping Mapping::operator+=(const Mapping& rhs) noexcept { *this = *this + rhs; return *this; } template - size_t Mapping::min_psize() const noexcept - { return util::bits::keepfirst(page_sizes); } + inline size_t Mapping::min_psize() const noexcept { + return util::bits::keepfirst(page_sizes); + } template - size_t Mapping::max_psize() const noexcept - { return util::bits::keeplast(page_sizes); } + inline size_t Mapping::max_psize() const noexcept { + return util::bits::keeplast(page_sizes); + } template - inline std::string Mapping::to_string() const - { + inline std::string Mapping::to_string() const { using namespace util::literals; char buffer[1024]; int len = snprintf(buffer, sizeof(buffer), @@ -281,47 +238,35 @@ namespace os::mem { " (%lu pages รก %s)", size / page_sizes, util::Byte_r(page_sizes).to_string().c_str()); - } - else { + } else { len += snprintf(buffer + len, sizeof(buffer) - len, " (page sizes: %s)", page_sizes_str(page_sizes).c_str()); } - return std::string(buffer, len); } - inline std::string page_sizes_str(size_t bits) - { + inline std::string page_sizes_str(size_t bits) { using namespace util::literals; if (bits == 0) return "None"; std::string out; - while (bits){ - auto ps = 1 << (__builtin_ffsl(bits) - 1); - bits &= ~ps; - out += util::Byte_r(ps).to_string(); - if (bits) - out += ", "; - } + while (bits) { + // index of lowest set bit (well-defined because bits != 0 here) + const unsigned tz = std::countr_zero(bits); - return out; - } + // convert that bit to the corresponding power-of-two size + const std::size_t ps = 1 << tz; - inline uintptr_t active_page_size(void* addr) { - return active_page_size((uintptr_t) addr); - } + // and remove that bit from the input + bits &= ~ps; - inline void - virtual_move(uintptr_t src, size_t size, uintptr_t dst, const char* label) - { - using namespace util::bitops; - const auto flags = os::mem::Access::read | os::mem::Access::write; - // setup @dst as new virt area for @src - os::mem::map({dst, src, flags, size}, label); - // unpresent @src - os::mem::protect(src, size, os::mem::Access::none); + // append formatted size; add a comma if there are more bits left + std::format_to(std::back_inserter(out), "{}", util::Byte_r(ps).to_string()); + if (bits) out += ", "; + } + return out; } -} +} // namespace os::mem -#endif // MEM_MEMORY_HPP +#endif // MEM_VMAP_HPP diff --git a/api/util/typename.hpp b/api/util/typename.hpp index 676f48ac76..87446be52e 100644 --- a/api/util/typename.hpp +++ b/api/util/typename.hpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include // Demangle diff --git a/lib/LiveUpdate/src/os.cpp b/lib/LiveUpdate/src/os.cpp index f85d439b65..5618343bd9 100644 --- a/lib/LiveUpdate/src/os.cpp +++ b/lib/LiveUpdate/src/os.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #define HIGHMEM_LOCATION (1ull << 45) //#define LIU_DEBUG 1 diff --git a/lib/LiveUpdate/src/storage.cpp b/lib/LiveUpdate/src/storage.cpp index abb7fed443..05f599fe9e 100644 --- a/lib/LiveUpdate/src/storage.cpp +++ b/lib/LiveUpdate/src/storage.cpp @@ -21,7 +21,7 @@ #include "storage.hpp" #include #include -#include +#include #include #include //#define VERIFY_MEMORY diff --git a/lib/LiveUpdate/src/update.cpp b/lib/LiveUpdate/src/update.cpp index 3f777fdb34..1aff0b8ed3 100644 --- a/lib/LiveUpdate/src/update.cpp +++ b/lib/LiveUpdate/src/update.cpp @@ -29,7 +29,6 @@ #include "storage.hpp" #include #include -#include #include // for flushing #define LPRINT(x, ...) printf(x, ##__VA_ARGS__); diff --git a/src/arch/aarch64/paging.cpp b/src/arch/aarch64/paging.cpp index eda50ca68e..f8877eae1c 100644 --- a/src/arch/aarch64/paging.cpp +++ b/src/arch/aarch64/paging.cpp @@ -15,8 +15,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include -#include +#include __attribute__((weak)) void __arch_init_paging() diff --git a/src/arch/i686/paging.cpp b/src/arch/i686/paging.cpp index 8779245939..032055d636 100644 --- a/src/arch/i686/paging.cpp +++ b/src/arch/i686/paging.cpp @@ -15,9 +15,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "mem/vmap.hpp" #include #include -#include __attribute__((weak)) void __arch_init_paging() diff --git a/src/arch/x86_64/ist.cpp b/src/arch/x86_64/ist.cpp index 059757e441..bb46081890 100644 --- a/src/arch/x86_64/ist.cpp +++ b/src/arch/x86_64/ist.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #ifdef DEBUG_IST #define IST_PRINT(X, ...) printf(X, __VA_ARGS__) diff --git a/src/kernel/elf.cpp b/src/kernel/elf.cpp index 20b1c5ff28..ddd771daa0 100644 --- a/src/kernel/elf.cpp +++ b/src/kernel/elf.cpp @@ -479,8 +479,7 @@ void elf_check_symbols_ok() } #ifdef ARCH_x86_64 -#include -#include +#include #include void elf_protect_symbol_areas() { diff --git a/src/kernel/liveupdate.cpp b/src/kernel/liveupdate.cpp index 0c9ba2e727..a1a12e1d9b 100644 --- a/src/kernel/liveupdate.cpp +++ b/src/kernel/liveupdate.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #define HIGHMEM_LOCATION (1ull << 45) //#define LIU_DEBUG 1 diff --git a/src/kernel/memmap.cpp b/src/kernel/memmap.cpp index 38ca1dd009..967817bbe0 100644 --- a/src/kernel/memmap.cpp +++ b/src/kernel/memmap.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/kernel/multiboot.cpp b/src/kernel/multiboot.cpp index 74573fdcc4..b25194cde7 100644 --- a/src/kernel/multiboot.cpp +++ b/src/kernel/multiboot.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include template diff --git a/src/kernel/system_log.cpp b/src/kernel/system_log.cpp index a16660a83f..748c86a0af 100644 --- a/src/kernel/system_log.cpp +++ b/src/kernel/system_log.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/musl/mlock.cpp b/src/musl/mlock.cpp index 9c1044e565..9328a2caf1 100644 --- a/src/musl/mlock.cpp +++ b/src/musl/mlock.cpp @@ -1,5 +1,4 @@ #include "common.hpp" -#include static long sys_mlock(const void* /* addr */, size_t /* len */) { diff --git a/src/musl/mmap.cpp b/src/musl/mmap.cpp index d218324948..2a28f4e4a8 100644 --- a/src/musl/mmap.cpp +++ b/src/musl/mmap.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/musl/mprotect.cpp b/src/musl/mprotect.cpp index 5be2bc6cbc..bcc4d71d4f 100644 --- a/src/musl/mprotect.cpp +++ b/src/musl/mprotect.cpp @@ -1,5 +1,4 @@ #include "common.hpp" -#include static long sys_mprotect(void* /*addr*/, size_t /*len*/, int /*prot*/) { diff --git a/src/net/buffer_store.cpp b/src/net/buffer_store.cpp index 13eecba202..17b089af59 100644 --- a/src/net/buffer_store.cpp +++ b/src/net/buffer_store.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/platform/x86_pc/idt.cpp b/src/platform/x86_pc/idt.cpp index 3d07f969a9..75c8e393cf 100644 --- a/src/platform/x86_pc/idt.cpp +++ b/src/platform/x86_pc/idt.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #define RING0_CODE_SEG 0x8 extern "C" { diff --git a/src/platform/x86_pc/os.cpp b/src/platform/x86_pc/os.cpp index 9b2097889c..d51512374a 100644 --- a/src/platform/x86_pc/os.cpp +++ b/src/platform/x86_pc/os.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/platform/x86_pc/softreset.cpp b/src/platform/x86_pc/softreset.cpp index aad752a7cd..0cb8c72f44 100644 --- a/src/platform/x86_pc/softreset.cpp +++ b/src/platform/x86_pc/softreset.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include using namespace util::literals; diff --git a/src/posix/memalign.cpp b/src/posix/memalign.cpp index 9281f5598a..b239ecf935 100644 --- a/src/posix/memalign.cpp +++ b/src/posix/memalign.cpp @@ -15,9 +15,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include -#include #include extern "C" diff --git a/test/integration/kernel/memmap/service.cpp b/test/integration/kernel/memmap/service.cpp index 017838fef9..ca8d2ebbca 100644 --- a/test/integration/kernel/memmap/service.cpp +++ b/test/integration/kernel/memmap/service.cpp @@ -16,7 +16,7 @@ // limitations under the License. #include -#include +#include #include diff --git a/test/integration/memory/paging/service.cpp b/test/integration/memory/paging/service.cpp index 595ee71a69..340df5550f 100644 --- a/test/integration/memory/paging/service.cpp +++ b/test/integration/memory/paging/service.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/test/unit/kernel/os_test.cpp b/test/unit/kernel/os_test.cpp index 92bdabe0a4..6722f6f8a3 100644 --- a/test/unit/kernel/os_test.cpp +++ b/test/unit/kernel/os_test.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include CASE("version() returns string representation of OS version") { diff --git a/test/unit/memory/generic/test_memory.cpp b/test/unit/memory/generic/test_memory.cpp index 3be60dccb8..d935f6c8ae 100644 --- a/test/unit/memory/generic/test_memory.cpp +++ b/test/unit/memory/generic/test_memory.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include diff --git a/test/unit/memory/mapping/memmap_test.cpp b/test/unit/memory/mapping/memmap_test.cpp index 66c082ff9b..adf5fb69c0 100644 --- a/test/unit/memory/mapping/memmap_test.cpp +++ b/test/unit/memory/mapping/memmap_test.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include using namespace os::mem; CASE ("Using the fixed memory range class") diff --git a/test/unit/memory/paging/x86_paging.cpp b/test/unit/memory/paging/x86_paging.cpp index 214e376bb6..9bf9c6f744 100644 --- a/test/unit/memory/paging/x86_paging.cpp +++ b/test/unit/memory/paging/x86_paging.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include using namespace util;