aboutsummaryrefslogtreecommitdiff
path: root/kapi
diff options
context:
space:
mode:
Diffstat (limited to 'kapi')
-rw-r--r--kapi/kapi/memory.hpp3
-rw-r--r--kapi/kapi/memory/page_mapper.hpp8
2 files changed, 7 insertions, 4 deletions
diff --git a/kapi/kapi/memory.hpp b/kapi/kapi/memory.hpp
index 4b14b553..2ae8b91b 100644
--- a/kapi/kapi/memory.hpp
+++ b/kapi/kapi/memory.hpp
@@ -82,7 +82,8 @@ namespace kapi::memory
//! @warning This function will panic if no page mapper has been registered, or the page is not mapped.
//!
//! @param page The page to unmap
- auto unmap(page page) -> void;
+ //! @return The frame the page was previously mapped to.
+ [[nodiscard]] auto unmap(page page) -> frame;
//! Initialize the Memory-mapped I/O region system.
//!
diff --git a/kapi/kapi/memory/page_mapper.hpp b/kapi/kapi/memory/page_mapper.hpp
index 5ac0210f..4a4827b6 100644
--- a/kapi/kapi/memory/page_mapper.hpp
+++ b/kapi/kapi/memory/page_mapper.hpp
@@ -11,6 +11,7 @@
#include <cstddef>
#include <cstdint>
+#include <optional>
#include <type_traits>
namespace kapi::memory
@@ -54,13 +55,14 @@ namespace kapi::memory
//! terminate execution via a kernel panic.
//!
//! @param page The page to unmap.
- virtual auto unmap(page page) -> void = 0;
+ //! @return The frame the page was previously mapped to.
+ virtual auto unmap(page page) -> frame = 0;
//! Try to unmap the given page.
//!
//! @param page The page to unmap
- //! @return true iff. the page was successfully unmapped, false otherwise.
- virtual auto try_unmap(page page) noexcept -> bool = 0;
+ //! @return The frame that was previously mapped to the page, if any.
+ virtual auto try_unmap(page page) noexcept -> std::optional<frame> = 0;
//! @qualifier kernel-defined
//! Map a page into a given frame, applyint the given flags.