aboutsummaryrefslogtreecommitdiff
path: root/kapi
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2025-10-29 11:40:49 +0100
committerFelix Morgner <felix.morgner@ost.ch>2025-10-29 11:40:49 +0100
commit845a96f5e6bfbbbeba19bf3df07f0e9de53d9a88 (patch)
tree07803f43051bdd27aa3eb947103320473b6e1b5d /kapi
parente7b04ef7f5da8e014e8b85fcf65448b317cca8ff (diff)
downloadteachos-845a96f5e6bfbbbeba19bf3df07f0e9de53d9a88.tar.xz
teachos-845a96f5e6bfbbbeba19bf3df07f0e9de53d9a88.zip
kapi: export frame_allocator interface
Diffstat (limited to 'kapi')
-rw-r--r--kapi/include/kapi/memory.hpp6
-rw-r--r--kapi/include/kapi/memory/frame_allocator.hpp19
2 files changed, 23 insertions, 2 deletions
diff --git a/kapi/include/kapi/memory.hpp b/kapi/include/kapi/memory.hpp
index 3ad5ac5..3daaa86 100644
--- a/kapi/include/kapi/memory.hpp
+++ b/kapi/include/kapi/memory.hpp
@@ -1,11 +1,13 @@
#ifndef TEACHOS_KAPI_MEMORY_HPP
#define TEACHOS_KAPI_MEMORY_HPP
-#include "kapi/memory/address.hpp" // IWYU pragma: export
-#include "kapi/memory/frame.hpp" // IWYU pragma: export
+#include "kapi/memory/address.hpp" // IWYU pragma: export
+#include "kapi/memory/frame.hpp" // IWYU pragma: export
+#include "kapi/memory/frame_allocator.hpp" // IWYU pragma: export
namespace teachos::memory
{
+ auto active_allocator() -> frame_allocator &;
auto init() -> void;
} // namespace teachos::memory
diff --git a/kapi/include/kapi/memory/frame_allocator.hpp b/kapi/include/kapi/memory/frame_allocator.hpp
new file mode 100644
index 0000000..f9393ee
--- /dev/null
+++ b/kapi/include/kapi/memory/frame_allocator.hpp
@@ -0,0 +1,19 @@
+#ifndef TEACHOS_KAPI_MEMORY_FRAME_ALLOCATOR_HPP
+#define TEACHOS_KAPI_MEMORY_FRAME_ALLOCATOR_HPP
+
+#include "kapi/memory/frame.hpp"
+
+#include <optional>
+
+namespace teachos::memory
+{
+
+ struct frame_allocator
+ {
+ virtual auto allocate() -> std::optional<frame> = 0;
+ virtual auto release(frame frame) -> void = 0;
+ };
+
+} // namespace teachos::memory
+
+#endif // TEACHOS_KAPI_MEMORY_FRAME_ALLOCATOR_HPP \ No newline at end of file