aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/pre
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/pre')
-rw-r--r--arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/segment_selector.hpp6
-rw-r--r--arch/x86_64/pre/include/arch/context_switching/syscall/main.hpp5
-rw-r--r--arch/x86_64/pre/include/arch/memory/allocator/tiny_frame_allocator.hpp2
-rw-r--r--arch/x86_64/pre/include/arch/memory/heap/global_heap_allocator.hpp19
-rw-r--r--arch/x86_64/pre/include/arch/memory/heap/heap_allocator.hpp8
-rw-r--r--arch/x86_64/pre/include/arch/memory/heap/linked_list_allocator.hpp6
-rw-r--r--arch/x86_64/pre/include/arch/memory/heap/user_heap_allocator.hpp6
-rw-r--r--arch/x86_64/pre/include/arch/memory/multiboot/reader.hpp2
-rw-r--r--arch/x86_64/pre/include/arch/memory/paging/active_page_table.hpp4
-rw-r--r--arch/x86_64/pre/include/arch/memory/paging/kernel_mapper.hpp18
-rw-r--r--arch/x86_64/pre/include/arch/memory/paging/page_table.hpp2
-rw-r--r--arch/x86_64/pre/include/arch/memory/paging/virtual_page.hpp4
-rw-r--r--arch/x86_64/pre/src/context_switching/interrupt_descriptor_table/idt_flags.cpp5
-rw-r--r--arch/x86_64/pre/src/context_switching/interrupt_descriptor_table/interrupt_descriptor_table.cpp2
-rw-r--r--arch/x86_64/pre/src/context_switching/interrupt_descriptor_table/segment_selector.cpp15
-rw-r--r--arch/x86_64/pre/src/context_switching/main.cpp13
-rw-r--r--arch/x86_64/pre/src/context_switching/segment_descriptor_table/access_byte.cpp5
-rw-r--r--arch/x86_64/pre/src/context_switching/segment_descriptor_table/gdt_flags.cpp10
-rw-r--r--arch/x86_64/pre/src/context_switching/segment_descriptor_table/global_descriptor_table.cpp10
-rw-r--r--arch/x86_64/pre/src/context_switching/segment_descriptor_table/segment_descriptor_base.cpp5
-rw-r--r--arch/x86_64/pre/src/context_switching/segment_descriptor_table/segment_descriptor_extension.cpp10
-rw-r--r--arch/x86_64/pre/src/context_switching/syscall/syscall_enable.cpp10
-rw-r--r--arch/x86_64/pre/src/context_switching/syscall/syscall_handler.cpp11
-rw-r--r--arch/x86_64/pre/src/exception_handling/abort.cpp5
-rw-r--r--arch/x86_64/pre/src/exception_handling/panic.cpp5
-rw-r--r--arch/x86_64/pre/src/kernel/cpu/if.cpp10
-rw-r--r--arch/x86_64/pre/src/kernel/cpu/msr.cpp2
-rw-r--r--arch/x86_64/pre/src/memory/allocator/area_frame_allocator.cpp5
-rw-r--r--arch/x86_64/pre/src/memory/heap/global_heap_allocator.cpp33
-rw-r--r--arch/x86_64/pre/src/memory/heap/memory_block.cpp5
-rw-r--r--arch/x86_64/pre/src/memory/heap/user_heap_allocator.cpp4
-rw-r--r--arch/x86_64/pre/src/memory/main.cpp4
-rw-r--r--arch/x86_64/pre/src/memory/multiboot/elf_symbols_section.cpp5
-rw-r--r--arch/x86_64/pre/src/memory/paging/active_page_table.cpp11
-rw-r--r--arch/x86_64/pre/src/memory/paging/page_entry.cpp27
-rw-r--r--arch/x86_64/pre/src/memory/paging/page_table.cpp20
-rw-r--r--arch/x86_64/pre/src/memory/paging/virtual_page.cpp7
37 files changed, 216 insertions, 105 deletions
diff --git a/arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/segment_selector.hpp b/arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/segment_selector.hpp
index 2a7704e..ea8c145 100644
--- a/arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/segment_selector.hpp
+++ b/arch/x86_64/pre/include/arch/context_switching/interrupt_descriptor_table/segment_selector.hpp
@@ -96,9 +96,9 @@ namespace teachos::arch::context_switching::interrupt_descriptor_table
private:
uint8_t _flags : 3 = {}; ///< Underlying bits used to read the flags from.
- uint16_t _index : 13 =
- {}; ///< Index into the local or global descriptor table. Processor multiplies the index value by 16 (number of
- ///< bytes in segment descriptor) and adds the result to the base address.
+ uint16_t _index
+ : 13 = {}; ///< Index into the local or global descriptor table. Processor multiplies the index value by 16
+ ///< (number of bytes in segment descriptor) and adds the result to the base address.
};
} // namespace teachos::arch::context_switching::interrupt_descriptor_table
diff --git a/arch/x86_64/pre/include/arch/context_switching/syscall/main.hpp b/arch/x86_64/pre/include/arch/context_switching/syscall/main.hpp
index 59adc13..f507c61 100644
--- a/arch/x86_64/pre/include/arch/context_switching/syscall/main.hpp
+++ b/arch/x86_64/pre/include/arch/context_switching/syscall/main.hpp
@@ -41,7 +41,10 @@ namespace teachos::arch::context_switching::syscall
* @param e Error code that was returned by the syscall.
* @return Return true if there was no error and false otherwise.
*/
- constexpr bool operator!(error e) { return e == error::OK; }
+ constexpr bool operator!(error e)
+ {
+ return e == error::OK;
+ }
/**
* @brief Maximum amount of arguments that can be passed to a syscall. Default value is 0 and arguments are only ever
diff --git a/arch/x86_64/pre/include/arch/memory/allocator/tiny_frame_allocator.hpp b/arch/x86_64/pre/include/arch/memory/allocator/tiny_frame_allocator.hpp
index 1ceb74d..1e4746d 100644
--- a/arch/x86_64/pre/include/arch/memory/allocator/tiny_frame_allocator.hpp
+++ b/arch/x86_64/pre/include/arch/memory/allocator/tiny_frame_allocator.hpp
@@ -10,7 +10,7 @@ namespace teachos::arch::memory::allocator
{
namespace
{
- uint8_t constexpr TINY_ALLOCATOR_FRAMES_COUNT = 3U;
+ constexpr uint8_t TINY_ALLOCATOR_FRAMES_COUNT = 3U;
}
/**
diff --git a/arch/x86_64/pre/include/arch/memory/heap/global_heap_allocator.hpp b/arch/x86_64/pre/include/arch/memory/heap/global_heap_allocator.hpp
index c98c130..480b1d0 100644
--- a/arch/x86_64/pre/include/arch/memory/heap/global_heap_allocator.hpp
+++ b/arch/x86_64/pre/include/arch/memory/heap/global_heap_allocator.hpp
@@ -37,7 +37,7 @@ namespace teachos::arch::memory::heap
*
* @param new_type Type of the heap allocation implementation we want to instantiate
*/
- static auto register_heap_allocator(heap_allocator_type new_type) -> void;
+ auto static register_heap_allocator(heap_allocator_type new_type) -> void;
/**
* @brief Allocates the given amount of memory and returns the pointer to the start of the allocatable memory area.
@@ -46,7 +46,7 @@ namespace teachos::arch::memory::heap
* @param size Amount of bytes that should be allocated
* @return void* Pointer to the start of the allocatable memory area
*/
- static auto kmalloc(std::size_t size) -> void *;
+ auto static kmalloc(std::size_t size) -> void *;
/**
* @brief Deallocated all memory associated with the memory area starting from the given pointer address.
@@ -54,7 +54,7 @@ namespace teachos::arch::memory::heap
*
* @param pointer Previously allocated memory area, that should now be freed
*/
- static auto kfree(void * pointer) noexcept -> void;
+ auto static kfree(void * pointer) noexcept -> void;
/**
* @brief Allocates the given amount of memory and returns the pointer to the start of the allocatable memory area.
@@ -64,7 +64,7 @@ namespace teachos::arch::memory::heap
* @return void* Pointer to the start of the allocatable memory area
*/
[[gnu::section(".user_text")]]
- static auto malloc(std::size_t size) -> void *;
+ auto static malloc(std::size_t size) -> void *;
/**
* @brief Deallocated all memory associated with the memory area starting from the given pointer address.
@@ -73,11 +73,11 @@ namespace teachos::arch::memory::heap
* @param pointer Previously allocated memory area, that should now be freed
*/
[[gnu::section(".user_text")]]
- static auto free(void * pointer) noexcept -> void;
+ auto static free(void * pointer) noexcept -> void;
private:
- static heap_allocator * kernel_allocator_instance; ///< Instance used to allocate and deallocate kernel heap memory
- [[gnu::section(".user_data")]] static user_heap_allocator *
+ heap_allocator static * kernel_allocator_instance; ///< Instance used to allocate and deallocate kernel heap memory
+ [[gnu::section(".user_data")]] user_heap_allocator static *
user_allocator_instance; ///< Instance used to allocate and deallocate user heap memory
/**
@@ -85,15 +85,14 @@ namespace teachos::arch::memory::heap
*
* @return Reference to the registered kernel heap allocation
*/
- static auto kernel() -> heap_allocator &;
+ auto static kernel() -> heap_allocator &;
/**
* @brief Either returns the previously registered heap allocated or halts further execution
*
* @return Reference to the registered user heap allocation
*/
- [[gnu::section(".user_text")]]
- static auto user() -> user_heap_allocator &;
+ [[gnu::section(".user_text")]] auto static user() -> user_heap_allocator &;
};
} // namespace teachos::arch::memory::heap
diff --git a/arch/x86_64/pre/include/arch/memory/heap/heap_allocator.hpp b/arch/x86_64/pre/include/arch/memory/heap/heap_allocator.hpp
index 420a1d3..6c25532 100644
--- a/arch/x86_64/pre/include/arch/memory/heap/heap_allocator.hpp
+++ b/arch/x86_64/pre/include/arch/memory/heap/heap_allocator.hpp
@@ -5,10 +5,10 @@
namespace teachos::arch::memory::heap
{
- std::size_t constexpr KERNEL_HEAP_START = 0x100000000;
- std::size_t constexpr KERNEL_HEAP_SIZE = 100 * 1024;
- std::size_t constexpr USER_HEAP_START = 0x100019000; // Starts directly after kernel heap
- std::size_t constexpr USER_HEAP_SIZE = 100 * 1024;
+ constexpr std::size_t KERNEL_HEAP_START = 0x1'0000'0000;
+ constexpr std::size_t KERNEL_HEAP_SIZE = 100 * 1024;
+ constexpr std::size_t USER_HEAP_START = 0x1'0001'9000; // Starts directly after kernel heap
+ constexpr std::size_t USER_HEAP_SIZE = 100 * 1024;
/**
* @brief Heap allocator interface containing methods required to allocate and deallocate heap memory areas
diff --git a/arch/x86_64/pre/include/arch/memory/heap/linked_list_allocator.hpp b/arch/x86_64/pre/include/arch/memory/heap/linked_list_allocator.hpp
index bbbad19..540ff5c 100644
--- a/arch/x86_64/pre/include/arch/memory/heap/linked_list_allocator.hpp
+++ b/arch/x86_64/pre/include/arch/memory/heap/linked_list_allocator.hpp
@@ -3,7 +3,6 @@
#include "arch/memory/heap/heap_allocator.hpp"
#include "arch/memory/heap/memory_block.hpp"
-
#include <kstd/mutex.hpp>
namespace teachos::arch::memory::heap
@@ -44,7 +43,10 @@ namespace teachos::arch::memory::heap
*
* @return Smallest allocatable block of heap memory.
*/
- auto constexpr min_allocatable_size() -> std::size_t { return sizeof(memory_block); }
+ constexpr auto min_allocatable_size() -> std::size_t
+ {
+ return sizeof(memory_block);
+ }
/**
* @brief Removes a free memory block from the free list and returns its address so the caller can allocate into it.
diff --git a/arch/x86_64/pre/include/arch/memory/heap/user_heap_allocator.hpp b/arch/x86_64/pre/include/arch/memory/heap/user_heap_allocator.hpp
index 3b47f15..15d8574 100644
--- a/arch/x86_64/pre/include/arch/memory/heap/user_heap_allocator.hpp
+++ b/arch/x86_64/pre/include/arch/memory/heap/user_heap_allocator.hpp
@@ -5,6 +5,7 @@
// #include <kstd/mutex.hpp>
#include <kstd/mutex.hpp>
+
#include <optional>
namespace teachos::arch::memory::heap
@@ -47,7 +48,10 @@ namespace teachos::arch::memory::heap
*
* @return Smallest allocatable block of heap memory.
*/
- [[gnu::section(".user_text")]] auto constexpr min_allocatable_size() -> std::size_t { return sizeof(memory_block); }
+ [[gnu::section(".user_text")]] constexpr auto min_allocatable_size() -> std::size_t
+ {
+ return sizeof(memory_block);
+ }
/**
* @brief Checks if the given memory block is big enough and if it is allocates into the current block.
diff --git a/arch/x86_64/pre/include/arch/memory/multiboot/reader.hpp b/arch/x86_64/pre/include/arch/memory/multiboot/reader.hpp
index c5464cb..ba80918 100644
--- a/arch/x86_64/pre/include/arch/memory/multiboot/reader.hpp
+++ b/arch/x86_64/pre/include/arch/memory/multiboot/reader.hpp
@@ -5,9 +5,9 @@
// #include "arch/memory/multiboot/memory_map.hpp"
#include "arch/memory/multiboot/elf_symbols_section.hpp"
+#include <multiboot2/information.hpp>
#include <cstdint>
-#include <multiboot2/information.hpp>
#include <span>
namespace teachos::arch::memory::multiboot
diff --git a/arch/x86_64/pre/include/arch/memory/paging/active_page_table.hpp b/arch/x86_64/pre/include/arch/memory/paging/active_page_table.hpp
index f68d8b6..abefd61 100644
--- a/arch/x86_64/pre/include/arch/memory/paging/active_page_table.hpp
+++ b/arch/x86_64/pre/include/arch/memory/paging/active_page_table.hpp
@@ -25,7 +25,7 @@ namespace teachos::arch::memory::paging
*
* @return Active single unique instance of the level 4 page table.
*/
- static auto create_or_get() -> active_page_table &;
+ auto static create_or_get() -> active_page_table &;
/**
* @brief Index operator overload to access specific mutable entry directy of the level 4 page table.
@@ -186,7 +186,7 @@ namespace teachos::arch::memory::paging
* @param handle Page Table handle we want to access the entry that should be cleared on.
*/
template<allocator::FrameAllocator T>
- static auto unmap_page_table_entry(T & allocator, virtual_page page, page_table_handle & handle) -> void
+ auto static unmap_page_table_entry(T & allocator, virtual_page page, page_table_handle & handle) -> void
{
auto level_index = page.get_level_index(handle.get_level());
auto & entry = handle[level_index];
diff --git a/arch/x86_64/pre/include/arch/memory/paging/kernel_mapper.hpp b/arch/x86_64/pre/include/arch/memory/paging/kernel_mapper.hpp
index 3afb54b..581f142 100644
--- a/arch/x86_64/pre/include/arch/memory/paging/kernel_mapper.hpp
+++ b/arch/x86_64/pre/include/arch/memory/paging/kernel_mapper.hpp
@@ -47,7 +47,7 @@ namespace teachos::arch::memory::paging
auto cr4 = kernel::cpu::read_control_register(kernel::cpu::control_register::CR4);
kernel::cpu::write_control_register(kernel::cpu::control_register::CR4, cr4 | 0x80);
- temporary_page temporary_page{virtual_page{0xCAFEBABE}, allocator};
+ temporary_page temporary_page{virtual_page{0xCAFE'BABE}, allocator};
decltype(auto) active_table = active_page_table::create_or_get();
auto const frame = allocator.allocate_frame();
exception_handling::assert(frame.has_value(),
@@ -124,14 +124,14 @@ namespace teachos::arch::memory::paging
auto map_elf_kernel_sections(active_page_table & active_table) -> void
{
exception_handling::assert(!mem_info.sections.empty(), "[Kernel Mapper] Kernel elf sections empty");
- std::array<uint64_t, 6U> constexpr USER_SECTION_BASES = {
- 0x102000, // .boot_bss (Contains statically allocated variables)
- 0x209000, // .stl_text (Contains code for custom std implementations and standard library code)
- 0x217000, // .user_text (Contains the actual user code executed)
- 0x21E000, // .user_data (Contains static user variables)
-
- 0x20A000 // .text (Necessary, because symbols for all template standard library features are placed here if
- // they were first used in the Kernel Code Section)
+ constexpr std::array<uint64_t, 6U> USER_SECTION_BASES = {
+ 0x102000, // .boot_bss (Contains statically allocated variables)
+ 0x209000, // .stl_text (Contains code for custom std implementations and standard library code)
+ 0x217000, // .user_text (Contains the actual user code executed)
+ 0x21E000, // .user_data (Contains static user variables)
+
+ 0x20A000 // .text (Necessary, because symbols for all template standard library features are placed here if
+ // they were first used in the Kernel Code Section)
};
for (auto const & section : mem_info.sections)
diff --git a/arch/x86_64/pre/include/arch/memory/paging/page_table.hpp b/arch/x86_64/pre/include/arch/memory/paging/page_table.hpp
index b972337..247086c 100644
--- a/arch/x86_64/pre/include/arch/memory/paging/page_table.hpp
+++ b/arch/x86_64/pre/include/arch/memory/paging/page_table.hpp
@@ -7,7 +7,7 @@
namespace teachos::arch::memory::paging
{
- std::size_t constexpr PAGE_TABLE_ENTRY_COUNT = 512U; ///< Default entry count of a page table in x86_84 is 512.
+ constexpr std::size_t 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.
diff --git a/arch/x86_64/pre/include/arch/memory/paging/virtual_page.hpp b/arch/x86_64/pre/include/arch/memory/paging/virtual_page.hpp
index a6c8c39..1a20eae 100644
--- a/arch/x86_64/pre/include/arch/memory/paging/virtual_page.hpp
+++ b/arch/x86_64/pre/include/arch/memory/paging/virtual_page.hpp
@@ -73,12 +73,12 @@ namespace teachos::arch::memory::paging
/**
* @brief Defaulted equals operator.
*/
- auto operator==(const virtual_page & other) const -> bool = default;
+ auto operator==(virtual_page const & other) const -> bool = default;
/**
* @brief Defaulted three-way comparsion operator.
*/
- auto operator<=>(const virtual_page & other) const -> std::partial_ordering = default;
+ auto operator<=>(virtual_page const & 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/pre/src/context_switching/interrupt_descriptor_table/idt_flags.cpp b/arch/x86_64/pre/src/context_switching/interrupt_descriptor_table/idt_flags.cpp
index d36a4c1..f3b9d5e 100644
--- a/arch/x86_64/pre/src/context_switching/interrupt_descriptor_table/idt_flags.cpp
+++ b/arch/x86_64/pre/src/context_switching/interrupt_descriptor_table/idt_flags.cpp
@@ -13,5 +13,8 @@ namespace teachos::arch::context_switching::interrupt_descriptor_table
return (std::bitset<8U>{_flags} & other) == other;
}
- auto idt_flags::operator|=(std::bitset<8U> other) -> void { _flags |= other.to_ulong(); }
+ auto idt_flags::operator|=(std::bitset<8U> other) -> void
+ {
+ _flags |= other.to_ulong();
+ }
} // namespace teachos::arch::context_switching::interrupt_descriptor_table
diff --git a/arch/x86_64/pre/src/context_switching/interrupt_descriptor_table/interrupt_descriptor_table.cpp b/arch/x86_64/pre/src/context_switching/interrupt_descriptor_table/interrupt_descriptor_table.cpp
index 7aa0859..8640385 100644
--- a/arch/x86_64/pre/src/context_switching/interrupt_descriptor_table/interrupt_descriptor_table.cpp
+++ b/arch/x86_64/pre/src/context_switching/interrupt_descriptor_table/interrupt_descriptor_table.cpp
@@ -33,7 +33,7 @@ namespace teachos::arch::context_switching::interrupt_descriptor_table
auto get_or_create_interrupt_descriptor_table() -> interrupt_descriptor_table &
{
// Interrupt Descriptor Table needs to be kept alive
- static interrupt_descriptor_table idt = create_interrupt_descriptor_table();
+ interrupt_descriptor_table static idt = create_interrupt_descriptor_table();
return idt;
}
diff --git a/arch/x86_64/pre/src/context_switching/interrupt_descriptor_table/segment_selector.cpp b/arch/x86_64/pre/src/context_switching/interrupt_descriptor_table/segment_selector.cpp
index 27f0a3b..25ba859 100644
--- a/arch/x86_64/pre/src/context_switching/interrupt_descriptor_table/segment_selector.cpp
+++ b/arch/x86_64/pre/src/context_switching/interrupt_descriptor_table/segment_selector.cpp
@@ -7,9 +7,18 @@ namespace teachos::arch::context_switching::interrupt_descriptor_table
return (std::bitset<3U>{_flags} & other) == other;
}
- auto segment_selector::get_index() const -> uint16_t { return _index; }
+ auto segment_selector::get_index() const -> uint16_t
+ {
+ return _index;
+ }
- auto segment_selector::operator|=(std::bitset<3U> other) -> void { _flags |= other.to_ulong(); }
+ auto segment_selector::operator|=(std::bitset<3U> other) -> void
+ {
+ _flags |= other.to_ulong();
+ }
- segment_selector::operator uint16_t() const { return *reinterpret_cast<uint16_t const *>(this); }
+ segment_selector::operator uint16_t() const
+ {
+ return *reinterpret_cast<uint16_t const *>(this);
+ }
} // namespace teachos::arch::context_switching::interrupt_descriptor_table
diff --git a/arch/x86_64/pre/src/context_switching/main.cpp b/arch/x86_64/pre/src/context_switching/main.cpp
index 9539428..3eb6dae 100644
--- a/arch/x86_64/pre/src/context_switching/main.cpp
+++ b/arch/x86_64/pre/src/context_switching/main.cpp
@@ -13,20 +13,23 @@ namespace teachos::arch::context_switching
namespace
{
constexpr interrupt_descriptor_table::segment_selector KERNEL_CODE_SEGMENT_SELECTOR{
- 1U, interrupt_descriptor_table::segment_selector::REQUEST_LEVEL_KERNEL};
+ 1U, interrupt_descriptor_table::segment_selector::REQUEST_LEVEL_KERNEL};
constexpr kernel::cpu::far_pointer KERNEL_CODE_POINTER{&kernel::cpu::reload_data_segment_registers,
KERNEL_CODE_SEGMENT_SELECTOR};
constexpr context_switching::interrupt_descriptor_table::segment_selector USER_CODE_SEGMENT_SELECTOR{
- 3U, context_switching::interrupt_descriptor_table::segment_selector::REQUEST_LEVEL_USER};
+ 3U, context_switching::interrupt_descriptor_table::segment_selector::REQUEST_LEVEL_USER};
constexpr context_switching::interrupt_descriptor_table::segment_selector USER_DATA_SEGMENT_SELECTOR{
- 4U, context_switching::interrupt_descriptor_table::segment_selector::REQUEST_LEVEL_USER};
+ 4U, context_switching::interrupt_descriptor_table::segment_selector::REQUEST_LEVEL_USER};
- auto reload_gdtr() -> void { kernel::cpu::call(KERNEL_CODE_POINTER); }
+ auto reload_gdtr() -> void
+ {
+ kernel::cpu::call(KERNEL_CODE_POINTER);
+ }
} // namespace
auto initialize_descriptor_tables() -> descriptor_tables
{
- static bool initalized = false;
+ bool static initalized = false;
if (!initalized)
{
diff --git a/arch/x86_64/pre/src/context_switching/segment_descriptor_table/access_byte.cpp b/arch/x86_64/pre/src/context_switching/segment_descriptor_table/access_byte.cpp
index e31e021..fcc72cf 100644
--- a/arch/x86_64/pre/src/context_switching/segment_descriptor_table/access_byte.cpp
+++ b/arch/x86_64/pre/src/context_switching/segment_descriptor_table/access_byte.cpp
@@ -13,5 +13,8 @@ namespace teachos::arch::context_switching::segment_descriptor_table
return (std::bitset<8U>{_flags} & other) == other;
}
- auto access_byte::operator|=(std::bitset<8U> other) -> void { _flags |= other.to_ulong(); }
+ auto access_byte::operator|=(std::bitset<8U> other) -> void
+ {
+ _flags |= other.to_ulong();
+ }
} // namespace teachos::arch::context_switching::segment_descriptor_table
diff --git a/arch/x86_64/pre/src/context_switching/segment_descriptor_table/gdt_flags.cpp b/arch/x86_64/pre/src/context_switching/segment_descriptor_table/gdt_flags.cpp
index e444a24..ad1366a 100644
--- a/arch/x86_64/pre/src/context_switching/segment_descriptor_table/gdt_flags.cpp
+++ b/arch/x86_64/pre/src/context_switching/segment_descriptor_table/gdt_flags.cpp
@@ -14,7 +14,13 @@ namespace teachos::arch::context_switching::segment_descriptor_table
return (std::bitset<4U>{_flags} & other) == other;
}
- auto gdt_flags::get_limit() const -> std::bitset<4U> { return std::bitset<4U>{_limit_2}; }
+ auto gdt_flags::get_limit() const -> std::bitset<4U>
+ {
+ return std::bitset<4U>{_limit_2};
+ }
- auto gdt_flags::operator|=(std::bitset<4U> other) -> void { _flags |= other.to_ulong(); }
+ auto gdt_flags::operator|=(std::bitset<4U> other) -> void
+ {
+ _flags |= other.to_ulong();
+ }
} // namespace teachos::arch::context_switching::segment_descriptor_table
diff --git a/arch/x86_64/pre/src/context_switching/segment_descriptor_table/global_descriptor_table.cpp b/arch/x86_64/pre/src/context_switching/segment_descriptor_table/global_descriptor_table.cpp
index bbcee31..1c4729f 100644
--- a/arch/x86_64/pre/src/context_switching/segment_descriptor_table/global_descriptor_table.cpp
+++ b/arch/x86_64/pre/src/context_switching/segment_descriptor_table/global_descriptor_table.cpp
@@ -12,8 +12,8 @@ namespace teachos::arch::context_switching::segment_descriptor_table
auto create_segment_descriptor(segment_descriptor_type segment_descriptor_type, access_byte access_level)
-> segment_descriptor_base
{
- uint64_t constexpr BASE = 0x0;
- std::bitset<20U> constexpr LIMIT{0xFFFFF};
+ constexpr uint64_t BASE = 0x0;
+ constexpr std::bitset<20U> LIMIT{0xFFFFF};
gdt_flags flags{gdt_flags::GRANULARITY, LIMIT};
access_level |= access_byte::PRESENT | access_byte::CODE_OR_DATA_SEGMENT;
@@ -33,7 +33,7 @@ namespace teachos::arch::context_switching::segment_descriptor_table
auto create_tss_descriptor(task_state_segment * tss) -> segment_descriptor_extension
{
- uint64_t constexpr TSS_LIMIT = sizeof(task_state_segment) - 1;
+ constexpr uint64_t TSS_LIMIT = sizeof(task_state_segment) - 1;
access_byte const tss_access_byte{access_byte::PRESENT | access_byte::DESCRIPTOR_LEVEL_KERNEL |
access_byte::TASK_STATE_SEGMENT_AVAILABLE};
gdt_flags const tss_gdt_flags{0U, TSS_LIMIT};
@@ -55,7 +55,7 @@ namespace teachos::arch::context_switching::segment_descriptor_table
create_segment_descriptor(segment_descriptor_type::DATA_SEGMENT, access_byte::DESCRIPTOR_LEVEL_USER);
// Task State Segment needs to be kept alive
- static auto tss = new task_state_segment();
+ auto static tss = new task_state_segment();
segment_descriptor_extension const tss_descriptor = create_tss_descriptor(tss);
global_descriptor_table global_descriptor_table{null_segment,
@@ -72,7 +72,7 @@ namespace teachos::arch::context_switching::segment_descriptor_table
auto get_or_create_gdt() -> global_descriptor_table &
{
// Global Descriptor Table needs to be kept alive
- static global_descriptor_table gdt = create_gdt();
+ global_descriptor_table static gdt = create_gdt();
return gdt;
}
diff --git a/arch/x86_64/pre/src/context_switching/segment_descriptor_table/segment_descriptor_base.cpp b/arch/x86_64/pre/src/context_switching/segment_descriptor_table/segment_descriptor_base.cpp
index 04804d9..c3a03fc 100644
--- a/arch/x86_64/pre/src/context_switching/segment_descriptor_table/segment_descriptor_base.cpp
+++ b/arch/x86_64/pre/src/context_switching/segment_descriptor_table/segment_descriptor_base.cpp
@@ -33,6 +33,9 @@ namespace teachos::arch::context_switching::segment_descriptor_table
: segment_descriptor_type::DATA_SEGMENT;
}
- segment_descriptor_base::operator uint64_t() const { return *reinterpret_cast<uint64_t const *>(this); }
+ segment_descriptor_base::operator uint64_t() const
+ {
+ return *reinterpret_cast<uint64_t const *>(this);
+ }
} // namespace teachos::arch::context_switching::segment_descriptor_table
diff --git a/arch/x86_64/pre/src/context_switching/segment_descriptor_table/segment_descriptor_extension.cpp b/arch/x86_64/pre/src/context_switching/segment_descriptor_table/segment_descriptor_extension.cpp
index a28ec9b..5ea0d8a 100644
--- a/arch/x86_64/pre/src/context_switching/segment_descriptor_table/segment_descriptor_extension.cpp
+++ b/arch/x86_64/pre/src/context_switching/segment_descriptor_table/segment_descriptor_extension.cpp
@@ -17,8 +17,14 @@ namespace teachos::arch::context_switching::segment_descriptor_table
// Nothing to do
}
- auto segment_descriptor_extension::get_first_gdt_entry() const -> segment_descriptor_base { return _base; }
+ auto segment_descriptor_extension::get_first_gdt_entry() const -> segment_descriptor_base
+ {
+ return _base;
+ }
- auto segment_descriptor_extension::get_second_gdt_entry() const -> uint64_t { return _base_3; }
+ auto segment_descriptor_extension::get_second_gdt_entry() const -> uint64_t
+ {
+ return _base_3;
+ }
} // namespace teachos::arch::context_switching::segment_descriptor_table
diff --git a/arch/x86_64/pre/src/context_switching/syscall/syscall_enable.cpp b/arch/x86_64/pre/src/context_switching/syscall/syscall_enable.cpp
index 3c43336..dbb3ed9 100644
--- a/arch/x86_64/pre/src/context_switching/syscall/syscall_enable.cpp
+++ b/arch/x86_64/pre/src/context_switching/syscall/syscall_enable.cpp
@@ -8,12 +8,12 @@ namespace teachos::arch::context_switching::syscall
{
namespace
{
- interrupt_descriptor_table::segment_selector constexpr KERNEL_CODE_SEGMENT_SELECTOR{
- 1U, interrupt_descriptor_table::segment_selector::REQUEST_LEVEL_KERNEL};
+ constexpr interrupt_descriptor_table::segment_selector KERNEL_CODE_SEGMENT_SELECTOR{
+ 1U, interrupt_descriptor_table::segment_selector::REQUEST_LEVEL_KERNEL};
- auto constexpr IA32_STAR_ADDRESS = 0xC0000081;
- auto constexpr IA32_LSTAR_ADDRESS = 0xC0000082;
- auto constexpr IA32_FMASK_ADDRESS = 0xC0000084;
+ constexpr auto IA32_STAR_ADDRESS = 0xC000'0081;
+ constexpr auto IA32_LSTAR_ADDRESS = 0xC000'0082;
+ constexpr auto IA32_FMASK_ADDRESS = 0xC000'0084;
} // namespace
diff --git a/arch/x86_64/pre/src/context_switching/syscall/syscall_handler.cpp b/arch/x86_64/pre/src/context_switching/syscall/syscall_handler.cpp
index 84dbe5f..c120f77 100644
--- a/arch/x86_64/pre/src/context_switching/syscall/syscall_handler.cpp
+++ b/arch/x86_64/pre/src/context_switching/syscall/syscall_handler.cpp
@@ -14,7 +14,7 @@ namespace teachos::arch::context_switching::syscall
{
auto write_to_vga_buffer(uint64_t buffer) -> response
{
- video::vga::text::write(reinterpret_cast<const char *>(buffer),
+ video::vga::text::write(reinterpret_cast<char const *>(buffer),
video::vga::text::common_attributes::green_on_black);
video::vga::text::newline();
return {error::OK};
@@ -22,11 +22,14 @@ namespace teachos::arch::context_switching::syscall
auto expand_user_heap() -> response
{
- static auto current_heap_end = memory::heap::USER_HEAP_START;
+ auto static current_heap_end = memory::heap::USER_HEAP_START;
uint64_t const heap_start = current_heap_end;
memory::remap_heap(heap_start, memory::heap::USER_HEAP_SIZE, memory::paging::entry::USER_ACCESSIBLE);
current_heap_end += memory::heap::USER_HEAP_SIZE;
- return {error::OK, {heap_start, memory::heap::USER_HEAP_SIZE}};
+ return {
+ error::OK,
+ {heap_start, memory::heap::USER_HEAP_SIZE}
+ };
}
} // namespace
@@ -62,7 +65,7 @@ namespace teachos::arch::context_switching::syscall
result = expand_user_heap();
break;
case type::ASSERT:
- teachos::arch::exception_handling::assert(arg_0, reinterpret_cast<const char *>(arg_1));
+ teachos::arch::exception_handling::assert(arg_0, reinterpret_cast<char const *>(arg_1));
break;
default:
teachos::arch::exception_handling::panic("[Syscall Handler] Invalid syscall number");
diff --git a/arch/x86_64/pre/src/exception_handling/abort.cpp b/arch/x86_64/pre/src/exception_handling/abort.cpp
index e12e4cb..5dc6869 100644
--- a/arch/x86_64/pre/src/exception_handling/abort.cpp
+++ b/arch/x86_64/pre/src/exception_handling/abort.cpp
@@ -11,5 +11,8 @@ namespace teachos::arch::exception_handling
* a matching implementation. Since the default implemenatation calls a number of functions the kernel does not
* currently implement, @p ::abort gets overridden to simply panic.
*/
- extern "C" auto abort() -> void { panic("Terminate was called, possibly due to an unhandled exception"); }
+ extern "C" auto abort() -> void
+ {
+ panic("Terminate was called, possibly due to an unhandled exception");
+ }
} // namespace teachos::arch::exception_handling
diff --git a/arch/x86_64/pre/src/exception_handling/panic.cpp b/arch/x86_64/pre/src/exception_handling/panic.cpp
index 8e3802a..9511a9a 100644
--- a/arch/x86_64/pre/src/exception_handling/panic.cpp
+++ b/arch/x86_64/pre/src/exception_handling/panic.cpp
@@ -7,7 +7,10 @@ namespace teachos::arch::exception_handling
{
extern "C" char const message_prefix_panic[];
- auto panic(char const * reason) -> void { panic(message_prefix_panic, reason); }
+ auto panic(char const * reason) -> void
+ {
+ panic(message_prefix_panic, reason);
+ }
auto panic(char const * prefix, char const * reason) -> void
{
diff --git a/arch/x86_64/pre/src/kernel/cpu/if.cpp b/arch/x86_64/pre/src/kernel/cpu/if.cpp
index 60a90a3..5d056fc 100644
--- a/arch/x86_64/pre/src/kernel/cpu/if.cpp
+++ b/arch/x86_64/pre/src/kernel/cpu/if.cpp
@@ -1,7 +1,13 @@
namespace teachos::arch::kernel::cpu
{
- auto set_interrupt_flag() -> void { asm volatile("sti"); }
+ auto set_interrupt_flag() -> void
+ {
+ asm volatile("sti");
+ }
- auto clear_interrupt_flag() -> void { asm volatile("cli"); }
+ auto clear_interrupt_flag() -> void
+ {
+ asm volatile("cli");
+ }
} // namespace teachos::arch::kernel::cpu
diff --git a/arch/x86_64/pre/src/kernel/cpu/msr.cpp b/arch/x86_64/pre/src/kernel/cpu/msr.cpp
index 9c474a1..9d6a318 100644
--- a/arch/x86_64/pre/src/kernel/cpu/msr.cpp
+++ b/arch/x86_64/pre/src/kernel/cpu/msr.cpp
@@ -4,7 +4,7 @@ namespace teachos::arch::kernel::cpu
{
namespace
{
- auto constexpr IA32_EFER_ADDRESS = 0xC0000080;
+ constexpr auto IA32_EFER_ADDRESS = 0xC000'0080;
}
auto read_msr(uint32_t msr) -> uint64_t
diff --git a/arch/x86_64/pre/src/memory/allocator/area_frame_allocator.cpp b/arch/x86_64/pre/src/memory/allocator/area_frame_allocator.cpp
index a5a1b49..3105023 100644
--- a/arch/x86_64/pre/src/memory/allocator/area_frame_allocator.cpp
+++ b/arch/x86_64/pre/src/memory/allocator/area_frame_allocator.cpp
@@ -81,5 +81,8 @@ namespace teachos::arch::memory::allocator
return allocate_frame();
}
- auto area_frame_allocator::deallocate_frame(physical_frame const & physical_frame) -> void { (void)physical_frame; }
+ auto area_frame_allocator::deallocate_frame(physical_frame const & physical_frame) -> void
+ {
+ (void)physical_frame;
+ }
} // namespace teachos::arch::memory::allocator
diff --git a/arch/x86_64/pre/src/memory/heap/global_heap_allocator.cpp b/arch/x86_64/pre/src/memory/heap/global_heap_allocator.cpp
index 35cd623..709cda1 100644
--- a/arch/x86_64/pre/src/memory/heap/global_heap_allocator.cpp
+++ b/arch/x86_64/pre/src/memory/heap/global_heap_allocator.cpp
@@ -27,13 +27,25 @@ namespace teachos::arch::memory::heap
heap_allocator * global_heap_allocator::kernel_allocator_instance = nullptr;
user_heap_allocator * global_heap_allocator::user_allocator_instance = nullptr;
- auto global_heap_allocator::kmalloc(std::size_t size) -> void * { return kernel().allocate(size); }
+ auto global_heap_allocator::kmalloc(std::size_t size) -> void *
+ {
+ return kernel().allocate(size);
+ }
- auto global_heap_allocator::kfree(void * pointer) noexcept -> void { kernel().deallocate(pointer); }
+ auto global_heap_allocator::kfree(void * pointer) noexcept -> void
+ {
+ kernel().deallocate(pointer);
+ }
- auto global_heap_allocator::malloc(std::size_t size) -> void * { return user().allocate(size); }
+ auto global_heap_allocator::malloc(std::size_t size) -> void *
+ {
+ return user().allocate(size);
+ }
- auto global_heap_allocator::free(void * pointer) noexcept -> void { user().deallocate(pointer); }
+ auto global_heap_allocator::free(void * pointer) noexcept -> void
+ {
+ user().deallocate(pointer);
+ }
auto global_heap_allocator::register_heap_allocator(heap_allocator_type new_type) -> void
{
@@ -45,20 +57,21 @@ namespace teachos::arch::memory::heap
case heap_allocator_type::NONE:
// Nothing to do
break;
- case heap_allocator_type::BUMP: {
- static bump_allocator kernel_allocator{KERNEL_HEAP_START, KERNEL_HEAP_START + KERNEL_HEAP_SIZE};
+ case heap_allocator_type::BUMP:
+ {
+ bump_allocator static kernel_allocator{KERNEL_HEAP_START, KERNEL_HEAP_START + KERNEL_HEAP_SIZE};
kernel_allocator_instance = &kernel_allocator;
break;
}
- case heap_allocator_type::LINKED_LIST: {
- static linked_list_allocator kernel_allocator{KERNEL_HEAP_START, KERNEL_HEAP_START + KERNEL_HEAP_SIZE};
+ case heap_allocator_type::LINKED_LIST:
+ {
+ linked_list_allocator static kernel_allocator{KERNEL_HEAP_START, KERNEL_HEAP_START + KERNEL_HEAP_SIZE};
kernel_allocator_instance = &kernel_allocator;
break;
}
}
- [[gnu::section(".user_data")]]
- static user_heap_allocator user_allocator{};
+ [[gnu::section(".user_data")]] user_heap_allocator static user_allocator{};
user_allocator_instance = &user_allocator;
}
diff --git a/arch/x86_64/pre/src/memory/heap/memory_block.cpp b/arch/x86_64/pre/src/memory/heap/memory_block.cpp
index bc97bd6..4c07454 100644
--- a/arch/x86_64/pre/src/memory/heap/memory_block.cpp
+++ b/arch/x86_64/pre/src/memory/heap/memory_block.cpp
@@ -11,5 +11,8 @@ namespace teachos::arch::memory::heap
this->next = next;
}
- memory_block::~memory_block() { memset(static_cast<void *>(this), 0U, sizeof(memory_block)); }
+ memory_block::~memory_block()
+ {
+ memset(static_cast<void *>(this), 0U, sizeof(memory_block));
+ }
} // namespace teachos::arch::memory::heap
diff --git a/arch/x86_64/pre/src/memory/heap/user_heap_allocator.cpp b/arch/x86_64/pre/src/memory/heap/user_heap_allocator.cpp
index 427a68a..96de005 100644
--- a/arch/x86_64/pre/src/memory/heap/user_heap_allocator.cpp
+++ b/arch/x86_64/pre/src/memory/heap/user_heap_allocator.cpp
@@ -39,7 +39,7 @@ namespace teachos::arch::memory::heap
}
}
- char constexpr OUT_OF_MEMORY_ERROR_MESSAGE[] = "[Linked List Allocator] Out of memory";
+ constexpr char OUT_OF_MEMORY_ERROR_MESSAGE[] = "[Linked List Allocator] Out of memory";
context_switching::syscall::syscall(context_switching::syscall::type::ASSERT,
{false, reinterpret_cast<uint64_t>(&OUT_OF_MEMORY_ERROR_MESSAGE)});
return nullptr;
@@ -178,7 +178,7 @@ namespace teachos::arch::memory::heap
// Check if the block we want to deallocate is contained in the previous block, because if it is it can only mean
// that the block has already been deallocated and we therefore attempted a double free.
- char constexpr DOUBLE_FREE_ERROR_MESSAGE[] = "[Linked List Allocator] Attempted double free detected";
+ constexpr char DOUBLE_FREE_ERROR_MESSAGE[] = "[Linked List Allocator] Attempted double free detected";
context_switching::syscall::syscall(
context_switching::syscall::type::ASSERT,
{previous_block == nullptr ||
diff --git a/arch/x86_64/pre/src/memory/main.cpp b/arch/x86_64/pre/src/memory/main.cpp
index 2746a71..b5980db 100644
--- a/arch/x86_64/pre/src/memory/main.cpp
+++ b/arch/x86_64/pre/src/memory/main.cpp
@@ -15,7 +15,7 @@ namespace teachos::arch::memory
{
namespace
{
- static std::optional<allocator::area_frame_allocator> frame_allocator;
+ std::optional<allocator::area_frame_allocator> static frame_allocator;
auto create_frame_allocator(multiboot::memory_information const & memory_information)
-> allocator::area_frame_allocator &
@@ -54,7 +54,7 @@ namespace teachos::arch::memory
auto initialize_memory_management() -> void
{
- static bool has_been_called = false;
+ bool static has_been_called = false;
arch::exception_handling::assert(!has_been_called,
"[Initialization] Memory management has already been initialized");
has_been_called = true;
diff --git a/arch/x86_64/pre/src/memory/multiboot/elf_symbols_section.cpp b/arch/x86_64/pre/src/memory/multiboot/elf_symbols_section.cpp
index f5d126b..3105120 100644
--- a/arch/x86_64/pre/src/memory/multiboot/elf_symbols_section.cpp
+++ b/arch/x86_64/pre/src/memory/multiboot/elf_symbols_section.cpp
@@ -2,7 +2,10 @@
namespace teachos::arch::memory::multiboot
{
- auto elf_section_flags::contains_flags(std::bitset<64U> other) const -> bool { return (flags & other) == other; }
+ auto elf_section_flags::contains_flags(std::bitset<64U> other) const -> bool
+ {
+ return (flags & other) == other;
+ }
auto elf_section_header::is_null() const -> bool
{
diff --git a/arch/x86_64/pre/src/memory/paging/active_page_table.cpp b/arch/x86_64/pre/src/memory/paging/active_page_table.cpp
index 0113869..930588d 100644
--- a/arch/x86_64/pre/src/memory/paging/active_page_table.cpp
+++ b/arch/x86_64/pre/src/memory/paging/active_page_table.cpp
@@ -4,18 +4,21 @@ namespace teachos::arch::memory::paging
{
namespace
{
- paging::virtual_address constexpr PAGE_TABLE_LEVEL_4_ADDRESS = 0xffffffff'fffff000;
+ constexpr paging::virtual_address PAGE_TABLE_LEVEL_4_ADDRESS = 0xffff'ffff'ffff'f000;
}
auto active_page_table::create_or_get() -> active_page_table &
{
- static page_table_handle active_handle{reinterpret_cast<page_table *>(PAGE_TABLE_LEVEL_4_ADDRESS),
+ page_table_handle static active_handle{reinterpret_cast<page_table *>(PAGE_TABLE_LEVEL_4_ADDRESS),
page_table_handle::LEVEL4};
- static active_page_table active_page{active_handle};
+ active_page_table static active_page{active_handle};
return active_page;
}
- auto active_page_table::operator[](std::size_t index) -> entry & { return active_handle[index]; }
+ auto active_page_table::operator[](std::size_t index) -> entry &
+ {
+ return active_handle[index];
+ }
auto active_page_table::translate_address(virtual_address address) -> std::optional<allocator::physical_address>
{
diff --git a/arch/x86_64/pre/src/memory/paging/page_entry.cpp b/arch/x86_64/pre/src/memory/paging/page_entry.cpp
index 57045ca..ec45068 100644
--- a/arch/x86_64/pre/src/memory/paging/page_entry.cpp
+++ b/arch/x86_64/pre/src/memory/paging/page_entry.cpp
@@ -6,7 +6,7 @@ namespace teachos::arch::memory::paging
{
namespace
{
- std::size_t constexpr PHYSICAL_ADDRESS_MASK = 0x000fffff'fffff000;
+ constexpr std::size_t PHYSICAL_ADDRESS_MASK = 0x000f'ffff'ffff'f000;
} // namespace
entry::entry(uint64_t flags)
@@ -33,11 +33,20 @@ namespace teachos::arch::memory::paging
}
}
- auto entry::is_unused() const -> bool { return flags == 0U; }
+ auto entry::is_unused() const -> bool
+ {
+ return flags == 0U;
+ }
- auto entry::set_unused() -> void { flags = 0U; }
+ auto entry::set_unused() -> void
+ {
+ flags = 0U;
+ }
- auto entry::set_user_accessible() -> void { flags |= entry::USER_ACCESSIBLE; }
+ auto entry::set_user_accessible() -> void
+ {
+ flags |= entry::USER_ACCESSIBLE;
+ }
auto entry::calculate_pointed_to_frame() const -> std::optional<allocator::physical_frame>
{
@@ -49,7 +58,10 @@ namespace teachos::arch::memory::paging
return std::nullopt;
}
- auto entry::contains_flags(std::bitset<64U> other) const -> bool { return (flags & other) == other; }
+ auto entry::contains_flags(std::bitset<64U> other) const -> bool
+ {
+ return (flags & other) == other;
+ }
auto entry::set_entry(allocator::physical_frame frame, std::bitset<64U> additional_flags) -> void
{
@@ -59,5 +71,8 @@ namespace teachos::arch::memory::paging
flags = frame.start_address() | additional_flags.to_ulong();
}
- auto entry::get_flags() const -> std::bitset<64U> { return flags.to_ulong() & ~PHYSICAL_ADDRESS_MASK; }
+ auto entry::get_flags() const -> std::bitset<64U>
+ {
+ return flags.to_ulong() & ~PHYSICAL_ADDRESS_MASK;
+ }
} // namespace teachos::arch::memory::paging
diff --git a/arch/x86_64/pre/src/memory/paging/page_table.cpp b/arch/x86_64/pre/src/memory/paging/page_table.cpp
index eb11810..e79c3e5 100644
--- a/arch/x86_64/pre/src/memory/paging/page_table.cpp
+++ b/arch/x86_64/pre/src/memory/paging/page_table.cpp
@@ -96,9 +96,15 @@ namespace teachos::arch::memory::paging
"[Page Table] Attempted to pass nullptr as table to page table table method");
}
- auto page_table_handle::zero_entries() -> void { table->zero_entries(); }
+ auto page_table_handle::zero_entries() -> void
+ {
+ table->zero_entries();
+ }
- auto page_table_handle::is_empty() const -> bool { return table->is_empty(); }
+ auto page_table_handle::is_empty() const -> bool
+ {
+ return table->is_empty();
+ }
auto page_table_handle::next_table(std::size_t table_index) const -> std::optional<page_table_handle>
{
@@ -113,9 +119,15 @@ namespace teachos::arch::memory::paging
return std::nullopt;
}
- auto page_table_handle::get_level() const -> page_table_handle::level { return table_level; }
+ auto page_table_handle::get_level() const -> page_table_handle::level
+ {
+ return table_level;
+ }
- auto page_table_handle::operator[](std::size_t index) -> entry & { return table->operator[](index); }
+ auto page_table_handle::operator[](std::size_t index) -> entry &
+ {
+ return table->operator[](index);
+ }
auto operator--(page_table_handle::level & value) -> page_table_handle::level &
{
diff --git a/arch/x86_64/pre/src/memory/paging/virtual_page.cpp b/arch/x86_64/pre/src/memory/paging/virtual_page.cpp
index d374156..8d34918 100644
--- a/arch/x86_64/pre/src/memory/paging/virtual_page.cpp
+++ b/arch/x86_64/pre/src/memory/paging/virtual_page.cpp
@@ -6,12 +6,15 @@ namespace teachos::arch::memory::paging
{
auto virtual_page::containing_address(virtual_address address) -> virtual_page
{
- exception_handling::assert(address < 0x00008000'00000000 || address >= 0xffff8000'00000000,
+ exception_handling::assert(address < 0x0000'8000'0000'0000 || address >= 0xffff'8000'0000'0000,
"[Virtual Page] Attempted to create virtual page from invalid address");
return virtual_page{address / allocator::PAGE_FRAME_SIZE};
}
- auto virtual_page::start_address() const -> virtual_address { return page_number * allocator::PAGE_FRAME_SIZE; }
+ auto virtual_page::start_address() const -> virtual_address
+ {
+ return page_number * allocator::PAGE_FRAME_SIZE;
+ }
auto virtual_page::get_level_index(page_table_handle::level level) const -> size_t
{