aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/include
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2024-10-28 13:32:09 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2024-10-28 13:32:09 +0000
commite5925df93411429340d2887594004aaa690d2ef5 (patch)
treea24bc2f7aaf897fead13e151a5c155b597664f16 /arch/x86_64/include
parentefcb913196ccf0386a557e8c1053c430e5896179 (diff)
downloadteachos-e5925df93411429340d2887594004aaa690d2ef5.tar.xz
teachos-e5925df93411429340d2887594004aaa690d2ef5.zip
Adjust constant and make all possible variables const
Diffstat (limited to 'arch/x86_64/include')
-rw-r--r--arch/x86_64/include/arch/memory/allocator/physical_frame.hpp6
-rw-r--r--arch/x86_64/include/arch/memory/paging/page_mapper.hpp10
-rw-r--r--arch/x86_64/include/arch/memory/paging/page_table.hpp4
-rw-r--r--arch/x86_64/include/arch/memory/paging/virtual_page.hpp4
-rw-r--r--arch/x86_64/include/arch/shared/random_access_iterator.hpp2
5 files changed, 13 insertions, 13 deletions
diff --git a/arch/x86_64/include/arch/memory/allocator/physical_frame.hpp b/arch/x86_64/include/arch/memory/allocator/physical_frame.hpp
index 87c14ac..39406af 100644
--- a/arch/x86_64/include/arch/memory/allocator/physical_frame.hpp
+++ b/arch/x86_64/include/arch/memory/allocator/physical_frame.hpp
@@ -8,7 +8,7 @@ namespace teachos::arch::memory::allocator
{
typedef std::size_t physical_address;
- constexpr std::size_t PAGE_FRAME_SIZE = 4096U; ///< Default page size of x86_84 is always 4KiB.
+ std::size_t constexpr PAGE_FRAME_SIZE = 4096U; ///< Default page size of x86_84 is always 4KiB.
/**
* @brief Specific physical frame containing helper functions to determine if a specific address is in that
@@ -41,12 +41,12 @@ namespace teachos::arch::memory::allocator
/**
* @brief Defaulted equals operator.
*/
- constexpr auto operator==(const physical_frame & other) const -> bool = default;
+ auto operator==(const physical_frame & other) const -> bool = default;
/**
* @brief Defaulted three-way comparsion operator.
*/
- constexpr auto operator<=>(const physical_frame & other) const -> std::partial_ordering = default;
+ auto operator<=>(const physical_frame & other) const -> std::partial_ordering = default;
std::size_t
frame_number; ///< Index number of the current physical frame, used to distinguish it from other frames.
diff --git a/arch/x86_64/include/arch/memory/paging/page_mapper.hpp b/arch/x86_64/include/arch/memory/paging/page_mapper.hpp
index e08f195..4edcea9 100644
--- a/arch/x86_64/include/arch/memory/paging/page_mapper.hpp
+++ b/arch/x86_64/include/arch/memory/paging/page_mapper.hpp
@@ -94,7 +94,7 @@ namespace teachos::arch::memory::paging
template<allocator::FrameAllocator T>
auto map_next_free_page_to_frame(T & allocator, virtual_page page, std::bitset<64U> flags) -> void
{
- auto frame = allocator.allocate_frame();
+ auto const frame = allocator.allocate_frame();
exception_handling::assert(frame.has_value(), "[Page mapper] Out of memory exception");
map_page_to_frame(allocator, page, frame.value(), flags);
}
@@ -107,7 +107,7 @@ namespace teachos::arch::memory::paging
template<allocator::FrameAllocator T>
auto identity_map(T & allocator, allocator::physical_frame frame, std::bitset<64U> flags) -> void
{
- auto page = virtual_page::containing_address(frame.start_address());
+ auto const page = virtual_page::containing_address(frame.start_address());
map_page_to_frame(allocator, page, frame, flags);
}
@@ -133,8 +133,8 @@ namespace teachos::arch::memory::paging
for (auto level = page_table_handle::LEVEL4; level != page_table_handle::LEVEL1; --level)
{
- auto level_index = page.get_level_index(level);
- auto next_handle = current_handle.next_table(level_index);
+ auto const level_index = page.get_level_index(level);
+ auto const next_handle = current_handle.next_table(level_index);
// The next table method failed even tough the page has to be mapped already, because translate_page did not fail.
// This can only mean that we attempted to unmap a huge page, which is not supported in the first place.
exception_handling::assert(next_handle.has_value(), "[Page Mapper] Unable to unmap huge pages");
@@ -142,7 +142,7 @@ namespace teachos::arch::memory::paging
}
auto level1_entry = current_handle[page.get_level_index(page_table_handle::LEVEL1)];
- auto level1_frame = level1_entry.calculate_pointed_to_frame();
+ auto const level1_frame = level1_entry.calculate_pointed_to_frame();
exception_handling::assert(level1_frame.has_value(),
"[Page Mapper] Attempted to unmap page, which has not been mapped previously");
level1_entry.set_unused();
diff --git a/arch/x86_64/include/arch/memory/paging/page_table.hpp b/arch/x86_64/include/arch/memory/paging/page_table.hpp
index 765e9bb..e4847e3 100644
--- a/arch/x86_64/include/arch/memory/paging/page_table.hpp
+++ b/arch/x86_64/include/arch/memory/paging/page_table.hpp
@@ -7,7 +7,7 @@
namespace teachos::arch::memory::paging
{
- constexpr std::size_t PAGE_TABLE_ENTRY_COUNT = 512U; ///< Default entry count of a page table in x86_84 is 512.
+ std::size_t constexpr PAGE_TABLE_ENTRY_COUNT = 512U; ///< Default entry count of a page table in x86_84 is 512.
/**
* @brief Forward delcaration of the page_table, because it should only be accessible over the handle.
@@ -85,7 +85,7 @@ namespace teachos::arch::memory::paging
// page table one level below.
if (!next_handle.has_value())
{
- auto allocated_frame = allocator.allocate_frame();
+ auto const allocated_frame = allocator.allocate_frame();
exception_handling::assert(allocated_frame.has_value(), "[Page mapper] Unable to allocate frame");
this->operator[](table_index).set_entry(allocated_frame.value(), entry::PRESENT | entry::WRITABLE);
// There should now be an entry at the previously not existent index, therefore we can simply access it again.
diff --git a/arch/x86_64/include/arch/memory/paging/virtual_page.hpp b/arch/x86_64/include/arch/memory/paging/virtual_page.hpp
index b9e2195..934ecf2 100644
--- a/arch/x86_64/include/arch/memory/paging/virtual_page.hpp
+++ b/arch/x86_64/include/arch/memory/paging/virtual_page.hpp
@@ -50,12 +50,12 @@ namespace teachos::arch::memory::paging
/**
* @brief Defaulted equals operator.
*/
- constexpr auto operator==(const virtual_page & other) const -> bool = default;
+ auto operator==(const virtual_page & other) const -> bool = default;
/**
* @brief Defaulted three-way comparsion operator.
*/
- constexpr auto operator<=>(const virtual_page & other) const -> std::partial_ordering = default;
+ auto operator<=>(const virtual_page & other) const -> std::partial_ordering = default;
std::size_t page_number; ///< Index number of the current virtual page, used to distinguish it from other pages.
};
diff --git a/arch/x86_64/include/arch/shared/random_access_iterator.hpp b/arch/x86_64/include/arch/shared/random_access_iterator.hpp
index 392b925..13deb68 100644
--- a/arch/x86_64/include/arch/shared/random_access_iterator.hpp
+++ b/arch/x86_64/include/arch/shared/random_access_iterator.hpp
@@ -56,7 +56,7 @@ namespace teachos::arch::shared
*/
auto operator++(int) -> random_access_iterator
{
- random_access_iterator old_value = *this;
+ random_access_iterator const old_value = *this;
++ptr;
return old_value;
}