aboutsummaryrefslogtreecommitdiff
path: root/kapi
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-11-14 17:54:57 +0100
committerFelix Morgner <felix.morgner@ost.ch>2026-11-22 14:20:36 +0100
commitdc5edf2193c14b17939ba9afe9eef4a907da053f (patch)
tree0c206c84f0f6656136bea5f9e77b3877492e4895 /kapi
parent1071297ee44d5102feb92b7a5d5ceb44e90622b7 (diff)
downloadkernel-dc5edf2193c14b17939ba9afe9eef4a907da053f.tar.xz
kernel-dc5edf2193c14b17939ba9afe9eef4a907da053f.zip
memory: harden MMIO mappings and update docs.
Diffstat (limited to 'kapi')
-rw-r--r--kapi/kapi/memory.hpp7
-rw-r--r--kapi/kapi/memory/page_mapper.hpp17
2 files changed, 17 insertions, 7 deletions
diff --git a/kapi/kapi/memory.hpp b/kapi/kapi/memory.hpp
index 4cdd6ac1..7979c7e1 100644
--- a/kapi/kapi/memory.hpp
+++ b/kapi/kapi/memory.hpp
@@ -103,9 +103,12 @@ namespace kapi::memory
//! Map a region of Memory-mapped I/O address space to a given hardware address using the given flags.
//!
//! @warning This function will panic if no page mapper has been registered, or the page has already been mapped.
- //! This function will not ensure that the frame is not already in use.
//!
- //! This function will always set the @p uncached flag.
+ //! @warning This function will not ensure that the frame is not already in use.
+ //!
+ //! @warning This function will panic if an attempt is made to map an MMIO region as executable.
+ //!
+ //! This function will always set the @p uncached, @p global, and @p supervisor_only flags.
//!
//! @param region The region to map.
//! @param hw_base The base of the hardware region.
diff --git a/kapi/kapi/memory/page_mapper.hpp b/kapi/kapi/memory/page_mapper.hpp
index 4a4827b6..889ef052 100644
--- a/kapi/kapi/memory/page_mapper.hpp
+++ b/kapi/kapi/memory/page_mapper.hpp
@@ -32,11 +32,18 @@ namespace kapi::memory
enum struct flags : std::uint64_t
{
empty,
- writable = 1 << 0, //! The page is writable.
- executable = 1 << 1, //! The page contains executable instructions.
- uncached = 1 << 2, //! The page contents must not be cached.
- supervisor_only = 1 << 3, //! The page is only accessible in supervisor mode.
- global = 1 << 4, //! The page translation persists across context switches.
+ //! The page is writable.
+ writable = 1 << 0,
+ //! The page contains executable instructions.
+ executable = 1 << 1,
+ //! The page contents must not be cached.
+ uncached = 1 << 2,
+ //! The page is only accessible in supervisor mode.
+ supervisor_only = 1 << 3,
+ //! The page translation persists across context switches.
+ //!
+ //! @note A given platform may not honor this flag.
+ global = 1 << 4,
};
virtual ~page_mapper() = default;