aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2025-12-15 16:28:16 +0100
committerFelix Morgner <felix.morgner@ost.ch>2025-12-15 16:28:16 +0100
commit43ddde5e30a0d71aa11025a5ae232cea83e7fbde (patch)
tree0b6366b98fe7c6968ae297d5c72ad4ee11c2715d /arch
parentb9a733b87e4ef1a2dcd17387cedf16402acd9fd7 (diff)
downloadteachos-43ddde5e30a0d71aa11025a5ae232cea83e7fbde.tar.xz
teachos-43ddde5e30a0d71aa11025a5ae232cea83e7fbde.zip
kapi: remodel memory API to follow cio API
Diffstat (limited to 'arch')
-rw-r--r--arch/x86_64/src/kapi/memory.cpp27
1 files changed, 3 insertions, 24 deletions
diff --git a/arch/x86_64/src/kapi/memory.cpp b/arch/x86_64/src/kapi/memory.cpp
index 748893a..abfb32e 100644
--- a/arch/x86_64/src/kapi/memory.cpp
+++ b/arch/x86_64/src/kapi/memory.cpp
@@ -21,19 +21,17 @@
#include <atomic>
#include <bit>
+#include <cstddef>
+#include <cstdint>
#include <memory>
#include <span>
+#include <utility>
namespace teachos::memory
{
namespace
{
- // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
- auto constinit allocator = static_cast<frame_allocator *>(nullptr);
- // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
- auto constinit mapper = static_cast<page_mapper *>(nullptr);
-
constexpr auto static unused_page_address = linear_address{0x0000'7fff'cafe'faceuz};
constexpr auto static recursive_page_map_index = x86_64::page_table::entry_count - 2;
@@ -152,25 +150,6 @@ namespace teachos::memory
} // namespace
- auto active_frame_allocator() -> frame_allocator &
- {
- if (!allocator)
- {
- system::panic("[x86_64] The frame allocator has not been set yet.");
- }
-
- return *allocator;
- }
-
- auto active_page_mapper() -> page_mapper &
- {
- if (!mapper)
- {
- system::panic("[x86_64] The page mapper has not been set you.");
- }
- return *mapper;
- }
-
auto init() -> void
{
auto static constinit is_initialized = std::atomic_flag{};