aboutsummaryrefslogtreecommitdiff
path: root/kapi/include/kapi/memory/layout.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'kapi/include/kapi/memory/layout.hpp')
-rw-r--r--kapi/include/kapi/memory/layout.hpp54
1 files changed, 0 insertions, 54 deletions
diff --git a/kapi/include/kapi/memory/layout.hpp b/kapi/include/kapi/memory/layout.hpp
deleted file mode 100644
index 733fa96..0000000
--- a/kapi/include/kapi/memory/layout.hpp
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef TEACHOS_KAPI_MEMORY_LAYOUT_HPP
-#define TEACHOS_KAPI_MEMORY_LAYOUT_HPP
-
-// IWYU pragma: private, include <kapi/memory.hpp>
-
-#include <kapi/memory/address.hpp>
-
-#include <kstd/units>
-
-namespace kapi::memory
-{
-
- //! The size of a single page of virtual memory.
- //!
- //! Platforms that use different sizes of pages are expected to emulate 4 KiB pages towards the kernel.
- constexpr auto page_size = kstd::units::KiB(4);
-
- //! The size of a single frame of physical memory.
- //!
- //! Platforms that use different sizes of frames are expected to emulate 4 KiB pages towards the kernel.
- constexpr auto frame_size = kstd::units::KiB(4);
-
- //! The linear base address of the higher-half direct map.
- //!
- //! Platforms are expected to provide a mapping of at least the first 512 GiB of available memory at this address.
- constexpr auto higher_half_direct_map_base = linear_address{0xffff'8000'0000'0000uz};
-
- //! The linear base address of the kernel heap.
- constexpr auto heap_base = linear_address{0xffff'c000'0000'0000uz};
-
- //! The linear base address of the memory region reserved for the metadata required by the PMM.
- constexpr auto pmm_metadata_base = linear_address{0xffff'd000'0000'0000uz};
-
- //! The linear base address of all Memory Mapped I/O mappings.
- constexpr auto mmio_base = linear_address{0xffff'e000'0000'0000uz};
-
- //! The linear base address of the loaded kernel image.
- constexpr auto kernel_base = linear_address{0xffff'ffff'8000'0000uz};
-
- //! Convert a physical address to a linear address using the higher-half direct map.
- constexpr auto hhdm_to_linear(physical_address address) -> linear_address
- {
- return linear_address{address.raw() + higher_half_direct_map_base.raw()};
- }
-
- //! Convert a linear address in the higher-half direct map to a physical address.
- constexpr auto hhdm_to_physical(linear_address address) -> physical_address
- {
- return physical_address{address.raw() - higher_half_direct_map_base.raw()};
- }
-
-} // namespace kapi::memory
-
-#endif \ No newline at end of file