aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/include/arch/memory/allocator/physical_frame.hpp8
-rw-r--r--arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp5
-rw-r--r--arch/x86_64/include/arch/memory/paging/virtual_page.hpp6
-rw-r--r--arch/x86_64/src/memory/allocator/physical_frame.cpp6
-rw-r--r--arch/x86_64/src/memory/paging/virtual_page.cpp6
5 files changed, 13 insertions, 18 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 b95687c..89e3cf8 100644
--- a/arch/x86_64/include/arch/memory/allocator/physical_frame.hpp
+++ b/arch/x86_64/include/arch/memory/allocator/physical_frame.hpp
@@ -20,14 +20,18 @@ namespace teachos::arch::memory::allocator
/**
* @brief Defaulted constructor.
*/
- physical_frame() = default;
+ constexpr physical_frame() = default;
/**
* @brief Constructor.
*
* @param frame_number Index number that should be assigned to this physical frame.
*/
- explicit physical_frame(std::size_t frame_number);
+ explicit constexpr physical_frame(std::size_t frame_number)
+ : frame_number(frame_number)
+ {
+ // Nothing to do
+ }
/**
* @brief Returns the physical frame the given address is contained in.
diff --git a/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp b/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp
index 3931db3..c62a02e 100644
--- a/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp
+++ b/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp
@@ -9,7 +9,7 @@ namespace teachos::arch::memory::paging
{
namespace
{
- std::size_t constexpr UNUSED_VIRTUAL_ADDRESS = 0xCAFEBABE;
+ virtual_page constexpr UNUSED_VIRTUAL_PAGE{0xCAFEBABE};
} // namespace
typedef shared::container<allocator::physical_frame_iterator> frame_container;
@@ -45,8 +45,7 @@ namespace teachos::arch::memory::paging
*/
auto remap_kernel() -> void
{
- virtual_page temporary_address{UNUSED_VIRTUAL_ADDRESS};
- temporary_page temporary_page{temporary_address, allocator};
+ temporary_page temporary_page{UNUSED_VIRTUAL_PAGE, allocator};
auto & active_table = active_page_table::create_or_get();
auto const frame = allocator.allocate_frame();
exception_handling::assert(frame.has_value(),
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 8c5613d..c319af2 100644
--- a/arch/x86_64/include/arch/memory/paging/virtual_page.hpp
+++ b/arch/x86_64/include/arch/memory/paging/virtual_page.hpp
@@ -22,7 +22,11 @@ namespace teachos::arch::memory::paging
*
* @param page_number Index number of the current virtual page, used to distinguish it from other pages.
*/
- explicit virtual_page(std::size_t page_number);
+ explicit constexpr virtual_page(std::size_t page_number)
+ : page_number(page_number)
+ {
+ // Nothing to do
+ }
/**
* @brief Returns the virtual page the given address is contained in.
diff --git a/arch/x86_64/src/memory/allocator/physical_frame.cpp b/arch/x86_64/src/memory/allocator/physical_frame.cpp
index 9307602..227745a 100644
--- a/arch/x86_64/src/memory/allocator/physical_frame.cpp
+++ b/arch/x86_64/src/memory/allocator/physical_frame.cpp
@@ -2,12 +2,6 @@
namespace teachos::arch::memory::allocator
{
- physical_frame::physical_frame(std::size_t frame_number)
- : frame_number(frame_number)
- {
- // Nothing to do
- }
-
auto physical_frame::containing_address(physical_address address) -> physical_frame
{
return physical_frame{address / PAGE_FRAME_SIZE};
diff --git a/arch/x86_64/src/memory/paging/virtual_page.cpp b/arch/x86_64/src/memory/paging/virtual_page.cpp
index c0ec88d..f798709 100644
--- a/arch/x86_64/src/memory/paging/virtual_page.cpp
+++ b/arch/x86_64/src/memory/paging/virtual_page.cpp
@@ -4,12 +4,6 @@
namespace teachos::arch::memory::paging
{
- virtual_page::virtual_page(std::size_t page_number)
- : page_number(page_number)
- {
- // Nothing to do
- }
-
auto virtual_page::containing_address(virtual_address address) -> virtual_page
{
exception_handling::assert(address < 0x00008000'00000000 || address >= 0xffff8000'00000000,