aboutsummaryrefslogtreecommitdiff
path: root/arch
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
parentefcb913196ccf0386a557e8c1053c430e5896179 (diff)
downloadteachos-e5925df93411429340d2887594004aaa690d2ef5.tar.xz
teachos-e5925df93411429340d2887594004aaa690d2ef5.zip
Adjust constant and make all possible variables const
Diffstat (limited to 'arch')
-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
-rw-r--r--arch/x86_64/src/kernel/main.cpp4
-rw-r--r--arch/x86_64/src/memory/allocator/area_frame_allocator.cpp12
-rw-r--r--arch/x86_64/src/memory/multiboot/reader.cpp47
-rw-r--r--arch/x86_64/src/memory/paging/page_entry.cpp2
-rw-r--r--arch/x86_64/src/memory/paging/page_mapper.cpp26
-rw-r--r--arch/x86_64/src/memory/paging/page_table.cpp22
-rw-r--r--arch/x86_64/src/memory/paging/virtual_page.cpp2
12 files changed, 71 insertions, 70 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;
}
diff --git a/arch/x86_64/src/kernel/main.cpp b/arch/x86_64/src/kernel/main.cpp
index 5186c21..e067b48 100644
--- a/arch/x86_64/src/kernel/main.cpp
+++ b/arch/x86_64/src/kernel/main.cpp
@@ -16,12 +16,12 @@ namespace teachos::arch::kernel
video::vga::text::cursor(false);
video::vga::text::write("TeachOS is starting up...", video::vga::text::common_attributes::green_on_black);
- auto memory_information = memory::multiboot::read_multiboot2();
+ auto const memory_information = memory::multiboot::read_multiboot2();
memory::allocator::area_frame_allocator allocator(memory_information);
size_t address = 42 * memory::paging::PAGE_TABLE_ENTRY_COUNT * memory::paging::PAGE_TABLE_ENTRY_COUNT *
memory::allocator::PAGE_FRAME_SIZE; // 42th P3 entry
- auto page = memory::paging::virtual_page::containing_address(address);
+ auto const page = memory::paging::virtual_page::containing_address(address);
memory::paging::map_next_free_page_to_frame(allocator, page, 0U);
auto optional_frame = memory::paging::translate_page(page);
video::vga::text::newline();
diff --git a/arch/x86_64/src/memory/allocator/area_frame_allocator.cpp b/arch/x86_64/src/memory/allocator/area_frame_allocator.cpp
index e03c66a..6ec3e95 100644
--- a/arch/x86_64/src/memory/allocator/area_frame_allocator.cpp
+++ b/arch/x86_64/src/memory/allocator/area_frame_allocator.cpp
@@ -28,7 +28,7 @@ namespace teachos::arch::memory::allocator
return physical_frame::containing_address(address) >= next_free_frame;
});
- auto lowest_area_with_free_frames =
+ auto const lowest_area_with_free_frames =
std::ranges::min_element(next_area_with_free_frames, [](multiboot::memory_area a, multiboot::memory_area b) {
return a.base_address < b.base_address;
});
@@ -37,7 +37,7 @@ namespace teachos::arch::memory::allocator
{
current_area = *lowest_area_with_free_frames;
// Update the `next_free_frame` according to the new memory area
- auto start_frame = physical_frame::containing_address(current_area.value().base_address);
+ auto const start_frame = physical_frame::containing_address(current_area.value().base_address);
if (next_free_frame < start_frame)
{
next_free_frame = start_frame;
@@ -47,16 +47,14 @@ namespace teachos::arch::memory::allocator
auto area_frame_allocator::allocate_frame() -> std::optional<physical_frame>
{
- /*
- * Only try to allocate memory if current_area is not null, because
- * the current_area is null if there is no more available memory.
- */
+ // Only try to allocate memory if current_area is not null, because
+ // the current_area is null if there is no more available memory.
if (!current_area.has_value())
{
return std::nullopt;
}
- auto address = current_area.value().base_address + current_area.value().area_length - 1;
+ auto const address = current_area.value().base_address + current_area.value().area_length - 1;
physical_frame current_area_last_frame = physical_frame::containing_address(address);
if (next_free_frame > current_area_last_frame)
diff --git a/arch/x86_64/src/memory/multiboot/reader.cpp b/arch/x86_64/src/memory/multiboot/reader.cpp
index 228aa09..c3a78df 100644
--- a/arch/x86_64/src/memory/multiboot/reader.cpp
+++ b/arch/x86_64/src/memory/multiboot/reader.cpp
@@ -21,14 +21,14 @@ namespace teachos::arch::memory::multiboot
auto process_memory_map(memory_map_header * mminfo, memory_area_container::iterator & begin_area,
memory_area_container::iterator & end_area) -> void
{
- auto expected_entry_size = mminfo->entry_size;
- constexpr auto actual_entry_size = sizeof(memory_area);
+ auto const expected_entry_size = mminfo->entry_size;
+ auto constexpr actual_entry_size = sizeof(memory_area);
exception_handling::assert(expected_entry_size == actual_entry_size,
"[Multiboot Reader] Unexpected memory area entry size");
- auto total_size = mminfo->info.size;
- auto total_entries_size = total_size - sizeof(memory_map_header) + actual_entry_size;
- auto number_of_entries = total_entries_size / actual_entry_size;
+ auto const total_size = mminfo->info.size;
+ auto const total_entries_size = total_size - sizeof(memory_map_header) + actual_entry_size;
+ auto const number_of_entries = total_entries_size / actual_entry_size;
begin_area = memory_area_container::iterator{&mminfo->entries};
end_area = begin_area + number_of_entries;
@@ -37,41 +37,41 @@ namespace teachos::arch::memory::multiboot
auto process_elf_sections(elf_symbols_section_header * symbol, uint64_t & kernel_start,
uint64_t & kernel_end) -> void
{
- auto expected_entry_size = symbol->entry_size;
- constexpr auto actual_entry_size = sizeof(elf_section_header);
+ auto const expected_entry_size = symbol->entry_size;
+ auto constexpr actual_entry_size = sizeof(elf_section_header);
exception_handling::assert(expected_entry_size == actual_entry_size,
"[Multiboot Reader] Unexpected elf section header entry size");
- auto expected_total_size = symbol->info.size;
- auto actual_total_entry_size = actual_entry_size * symbol->number_of_sections;
- constexpr auto actual_total_section_size = sizeof(elf_symbols_section_header) - sizeof(uint32_t);
- auto actual_total_size = actual_total_entry_size + actual_total_section_size;
+ auto const expected_total_size = symbol->info.size;
+ auto const actual_total_entry_size = actual_entry_size * symbol->number_of_sections;
+ auto constexpr actual_total_section_size = sizeof(elf_symbols_section_header) - sizeof(uint32_t);
+ auto const actual_total_size = actual_total_entry_size + actual_total_section_size;
exception_handling::assert(expected_total_size == actual_total_size,
"[Multiboot Reader] Unexpected elf symbols section header total size");
- auto begin = elf_section_header_container::iterator{reinterpret_cast<elf_section_header *>(&symbol->end)};
- auto end = begin + symbol->number_of_sections;
+ auto const begin = elf_section_header_container::iterator{reinterpret_cast<elf_section_header *>(&symbol->end)};
+ auto const end = begin + symbol->number_of_sections;
exception_handling::assert(begin->is_null(),
"[Multiboot Reader] Elf symbols section not starting with SHT_NULL section");
elf_section_header_container container{begin, end};
- auto elf_section_with_lowest_virtual_address =
+ auto const elf_section_with_lowest_virtual_address =
std::ranges::min_element(container, [](elf_section_header const & a, elf_section_header const & b) {
return a.virtual_address < b.virtual_address;
});
- auto elf_section_with_highest_virtual_address =
+ auto const elf_section_with_highest_virtual_address =
std::ranges::max_element(container, [](elf_section_header const & a, elf_section_header const & b) {
auto a_virtual_address_end = a.virtual_address + a.section_size;
auto b_virtual_address_end = b.virtual_address + b.section_size;
return a_virtual_address_end < b_virtual_address_end;
});
- auto symbol_table_section_count = std::ranges::count_if(container, [](elf_section_header const & section) {
+ auto const symbol_table_section_count = std::ranges::count_if(container, [](elf_section_header const & section) {
return section.type == elf_section_type::DYNAMIC_SYMBOL_TABLE || section.type == elf_section_type::SYMBOL_TABLE;
});
- auto dynamic_section_count = std::ranges::count_if(
+ auto const dynamic_section_count = std::ranges::count_if(
container, [](elf_section_header const & section) { return section.type == elf_section_type::DYNAMIC; });
exception_handling::assert(
@@ -81,10 +81,10 @@ namespace teachos::arch::memory::multiboot
dynamic_section_count <= 1U,
"[Multiboot Reader] ELF Specifications allows only (1) or less dynamic sections, but got more");
- auto lowest_elf_section = *elf_section_with_lowest_virtual_address;
+ auto const lowest_elf_section = *elf_section_with_lowest_virtual_address;
kernel_start = lowest_elf_section.virtual_address;
- auto highest_elf_section = *elf_section_with_highest_virtual_address;
+ auto const highest_elf_section = *elf_section_with_highest_virtual_address;
kernel_end = highest_elf_section.virtual_address + highest_elf_section.section_size;
}
} // namespace
@@ -98,8 +98,8 @@ namespace teachos::arch::memory::multiboot
memory_area_container::iterator{},
memory_area_container::iterator{}};
- auto multiboot_information_pointer = reinterpret_cast<info_header *>(boot::multiboot_information_pointer);
- auto multiboot_tag = &multiboot_information_pointer->tags;
+ auto const multiboot_information_pointer = reinterpret_cast<info_header *>(boot::multiboot_information_pointer);
+ auto const multiboot_tag = &multiboot_information_pointer->tags;
mem_info.multiboot_end = mem_info.multiboot_start + multiboot_information_pointer->total_size;
for (auto tag = multiboot_tag; tag->type != tag_type::END; tag = align_to_8_byte_boundary(tag, tag->size))
@@ -107,12 +107,12 @@ namespace teachos::arch::memory::multiboot
switch (tag->type)
{
case tag_type::ELF_SECTIONS: {
- auto symbol = reinterpret_cast<elf_symbols_section_header *>(tag);
+ auto const symbol = reinterpret_cast<elf_symbols_section_header *>(tag);
process_elf_sections(symbol, mem_info.kernel_start, mem_info.kernel_end);
break;
}
case tag_type::MEMORY_MAP: {
- auto mminfo = reinterpret_cast<memory_map_header *>(tag);
+ auto const mminfo = reinterpret_cast<memory_map_header *>(tag);
process_memory_map(mminfo, mem_info.begin_area, mem_info.end_area);
break;
}
@@ -121,7 +121,6 @@ namespace teachos::arch::memory::multiboot
break;
}
}
-
return mem_info;
}
} // namespace teachos::arch::memory::multiboot
diff --git a/arch/x86_64/src/memory/paging/page_entry.cpp b/arch/x86_64/src/memory/paging/page_entry.cpp
index dbf23e2..8923fea 100644
--- a/arch/x86_64/src/memory/paging/page_entry.cpp
+++ b/arch/x86_64/src/memory/paging/page_entry.cpp
@@ -6,7 +6,7 @@ namespace teachos::arch::memory::paging
{
namespace
{
- constexpr std::size_t PHYSICAL_ADDRESS_MASK = 0x000fffff'fffff000;
+ std::size_t constexpr PHYSICAL_ADDRESS_MASK = 0x000fffff'fffff000;
}
entry::entry(uint64_t flags)
diff --git a/arch/x86_64/src/memory/paging/page_mapper.cpp b/arch/x86_64/src/memory/paging/page_mapper.cpp
index fb9ea39..3baf6ae 100644
--- a/arch/x86_64/src/memory/paging/page_mapper.cpp
+++ b/arch/x86_64/src/memory/paging/page_mapper.cpp
@@ -4,11 +4,15 @@
namespace teachos::arch::memory::paging
{
+ namespace
+ {
+ std::size_t constexpr PAGE_TABLE_LEVEL_4_ADDRESS = 0xffffffff'fffff000;
+ } // namespace
auto create_or_get() -> page_table_handle
{
static auto initialized = false;
- static page_table_handle active_handle{reinterpret_cast<page_table *>(0xffffffff'fffff000),
+ static page_table_handle active_handle{reinterpret_cast<page_table *>(PAGE_TABLE_LEVEL_4_ADDRESS),
page_table_handle::LEVEL4};
if (!initialized)
@@ -22,9 +26,9 @@ namespace teachos::arch::memory::paging
auto translate_address(virtual_address address) -> std::optional<allocator::physical_address>
{
- auto offset = address % allocator::PAGE_FRAME_SIZE;
- auto page = virtual_page::containing_address(address);
- auto frame = translate_page(page);
+ auto const offset = address % allocator::PAGE_FRAME_SIZE;
+ auto const page = virtual_page::containing_address(address);
+ auto const frame = translate_page(page);
if (frame.has_value())
{
@@ -40,7 +44,7 @@ namespace teachos::arch::memory::paging
for (auto level = page_table_handle::LEVEL4; level != page_table_handle::LEVEL1; --level)
{
- auto next_handle = current_handle.next_table(page.get_level_index(level));
+ auto const next_handle = current_handle.next_table(page.get_level_index(level));
// If the next table method failed then it is highly likely that it was a huge page and we therefore have to
// parse the table differently. Therefore, we attempt to parse it using the method required by huge pages.
if (!next_handle.has_value())
@@ -50,8 +54,8 @@ namespace teachos::arch::memory::paging
current_handle = next_handle.value();
}
- auto level1_index = page.get_level_index(page_table_handle::LEVEL1);
- auto level1_frame = current_handle[level1_index].calculate_pointed_to_frame();
+ auto const level1_index = page.get_level_index(page_table_handle::LEVEL1);
+ auto const level1_frame = current_handle[level1_index].calculate_pointed_to_frame();
return level1_frame;
}
@@ -65,8 +69,8 @@ namespace teachos::arch::memory::paging
return std::nullopt;
}
- auto level3_entry = level3_handle.value()[page.get_level_index(page_table_handle::LEVEL3)];
- auto level3_frame = level3_entry.calculate_pointed_to_frame();
+ auto const level3_entry = level3_handle.value()[page.get_level_index(page_table_handle::LEVEL3)];
+ auto const level3_frame = level3_entry.calculate_pointed_to_frame();
if (level3_frame.has_value() && level3_entry.contains_flags(entry::HUGE_PAGE))
{
exception_handling::assert(
@@ -80,8 +84,8 @@ namespace teachos::arch::memory::paging
auto level2_handle = level3_handle.value().next_table(page.get_level_index(page_table_handle::LEVEL3));
if (level2_handle.has_value())
{
- auto level2_entry = level2_handle.value()[page.get_level_index(page_table_handle::LEVEL2)];
- auto level2_frame = level2_entry.calculate_pointed_to_frame();
+ auto const level2_entry = level2_handle.value()[page.get_level_index(page_table_handle::LEVEL2)];
+ auto const level2_frame = level2_entry.calculate_pointed_to_frame();
if (level2_frame.has_value() && level2_entry.contains_flags(entry::HUGE_PAGE))
{
exception_handling::assert(level2_frame.value().frame_number % PAGE_TABLE_ENTRY_COUNT == 0U,
diff --git a/arch/x86_64/src/memory/paging/page_table.cpp b/arch/x86_64/src/memory/paging/page_table.cpp
index e919a1e..a01c431 100644
--- a/arch/x86_64/src/memory/paging/page_table.cpp
+++ b/arch/x86_64/src/memory/paging/page_table.cpp
@@ -60,9 +60,9 @@ namespace teachos::arch::memory::paging
auto page_table::zero_entries() -> void
{
- constexpr size_t entry_amount = sizeof(entries) / sizeof(entries[0]);
+ std::size_t constexpr entry_amount = sizeof(entries) / sizeof(entries[0]);
static_assert(entry_amount == PAGE_TABLE_ENTRY_COUNT);
- for (size_t i = 0; i < entry_amount; ++i)
+ for (std::size_t i = 0; i < entry_amount; ++i)
{
auto entry = this->operator[](i);
entry.set_unused();
@@ -71,7 +71,7 @@ namespace teachos::arch::memory::paging
auto page_table::next_table(std::size_t table_index) -> std::optional<page_table *>
{
- auto address = next_table_address(table_index);
+ auto const address = next_table_address(table_index);
if (address.has_value())
{
return reinterpret_cast<page_table *>(address.value());
@@ -89,11 +89,11 @@ namespace teachos::arch::memory::paging
auto page_table::next_table_address(std::size_t table_index) -> std::optional<std::size_t>
{
- auto entry = this->operator[](table_index);
+ auto const entry = this->operator[](table_index);
if (entry.contains_flags(entry::PRESENT) && !entry.contains_flags(entry::HUGE_PAGE))
{
- std::size_t const table_address = reinterpret_cast<std::size_t>(this);
+ auto const table_address = reinterpret_cast<std::size_t>(this);
return ((table_address << 9) | (table_index << 12));
}
return std::nullopt;
@@ -113,17 +113,17 @@ namespace teachos::arch::memory::paging
exception_handling::assert(handle_level == page_table_handle::LEVEL4,
"[Page Table] Attempted to initialize a page table of level 3 or lower");
auto level3_page_table = std::construct_at(reinterpret_cast<page_table *>(&_end_of_image));
- for (size_t n = 1; n <= PAGE_TABLE_ENTRY_COUNT; ++n)
+ for (std::size_t n = 1; n <= PAGE_TABLE_ENTRY_COUNT; ++n)
{
- size_t offset = sizeof(page_table) * n;
+ std::size_t offset = sizeof(page_table) * n;
std::construct_at(reinterpret_cast<page_table *>(&_end_of_image + offset));
- for (size_t m = 1; m <= PAGE_TABLE_ENTRY_COUNT; ++m)
+ for (std::size_t m = 1; m <= PAGE_TABLE_ENTRY_COUNT; ++m)
{
- size_t offset = sizeof(page_table) * ((PAGE_TABLE_ENTRY_COUNT * n) + m);
+ std::size_t offset = sizeof(page_table) * ((PAGE_TABLE_ENTRY_COUNT * n) + m);
std::construct_at(reinterpret_cast<page_table *>(&_end_of_image + offset));
}
}
- size_t const flags = reinterpret_cast<size_t>(level3_page_table);
+ std::size_t const flags = reinterpret_cast<std::size_t>(level3_page_table);
this->operator[](0U) = entry{flags};
*/
}
@@ -134,7 +134,7 @@ namespace teachos::arch::memory::paging
{
exception_handling::assert(handle_level != page_table_handle::LEVEL1,
"[Page Table] Attempted to call next_table on level 1 page table");
- auto next_table = handle->next_table(table_index);
+ auto const next_table = handle->next_table(table_index);
if (next_table.has_value())
{
return page_table_handle{next_table.value(), --handle_level};
diff --git a/arch/x86_64/src/memory/paging/virtual_page.cpp b/arch/x86_64/src/memory/paging/virtual_page.cpp
index d39bb7f..4221335 100644
--- a/arch/x86_64/src/memory/paging/virtual_page.cpp
+++ b/arch/x86_64/src/memory/paging/virtual_page.cpp
@@ -12,7 +12,7 @@ namespace teachos::arch::memory::paging
auto virtual_page::containing_address(virtual_address address) -> virtual_page
{
- exception_handling::assert(address < 0x0000800000000000 || address >= 0xffff800000000000,
+ exception_handling::assert(address < 0x00008000'00000000 || address >= 0xffff8000'00000000,
"[Virtual Page] Attempted to create virtual page from invalid address");
return virtual_page{address / allocator::PAGE_FRAME_SIZE};
}