From 845a96f5e6bfbbbeba19bf3df07f0e9de53d9a88 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Wed, 29 Oct 2025 11:40:49 +0100 Subject: kapi: export frame_allocator interface --- kapi/include/kapi/memory.hpp | 6 ++++-- kapi/include/kapi/memory/frame_allocator.hpp | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 kapi/include/kapi/memory/frame_allocator.hpp (limited to 'kapi') 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 + +namespace teachos::memory +{ + + struct frame_allocator + { + virtual auto allocate() -> std::optional = 0; + virtual auto release(frame frame) -> void = 0; + }; + +} // namespace teachos::memory + +#endif // TEACHOS_KAPI_MEMORY_FRAME_ALLOCATOR_HPP \ No newline at end of file -- cgit v1.2.3