aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64
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 /arch/x86_64
parent1071297ee44d5102feb92b7a5d5ceb44e90622b7 (diff)
downloadkernel-dc5edf2193c14b17939ba9afe9eef4a907da053f.tar.xz
kernel-dc5edf2193c14b17939ba9afe9eef4a907da053f.zip
memory: harden MMIO mappings and update docs.
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/arch/memory/mmu.hpp2
-rw-r--r--arch/x86_64/arch/memory/page_table.hpp34
2 files changed, 26 insertions, 10 deletions
diff --git a/arch/x86_64/arch/memory/mmu.hpp b/arch/x86_64/arch/memory/mmu.hpp
index 934aa63f..f824ba53 100644
--- a/arch/x86_64/arch/memory/mmu.hpp
+++ b/arch/x86_64/arch/memory/mmu.hpp
@@ -11,6 +11,8 @@ namespace arch::memory
auto tlb_flush(kapi::memory::linear_address address) -> void;
//! Invalidate all translation lookaside buffer (TLB) entries
+ //!
+ //! @note Once CR4.PGE is set, this function will no longer flush TLB entries for global pages.
auto tlb_flush_all() -> void;
} // namespace arch::memory
diff --git a/arch/x86_64/arch/memory/page_table.hpp b/arch/x86_64/arch/memory/page_table.hpp
index 0c0f1a77..c34f72e0 100644
--- a/arch/x86_64/arch/memory/page_table.hpp
+++ b/arch/x86_64/arch/memory/page_table.hpp
@@ -40,16 +40,30 @@ namespace arch::memory
enum struct flags : std::uint64_t
{
empty = 0,
- present = 1uz << 0, //!< The page is mapped.
- writable = 1uz << 1, //!< The page is writable.
- user_accessible = 1uz << 2, //!< The page is accessible in user mode.
- write_through = 1uz << 3, //!< Any writes to the page must immediately hit memory.
- disable_cache = 1uz << 4, //!< Any writes to the page must never be cached.
- accessed = 1uz << 5, //!< The page was accessed.
- dirty = 1uz << 6, //!< The page was written to.
- huge_page = 1uz << 7, //!< The page is huge.
- global = 1uz << 8, //!< The TLB entry for this page must not be flushed on context switches.
- no_execute = 1uz << 63, //!< The data in this page must not be executed.
+ //! The page is mapped.
+ present = 1uz << 0,
+ //! The page is writable.
+ writable = 1uz << 1,
+ //! The page is accessible in user mode.
+ user_accessible = 1uz << 2,
+ //! Any writes to the page must immediately hit memory.
+ write_through = 1uz << 3,
+ //! Any writes to the page must never be cached.
+ disable_cache = 1uz << 4,
+ //! The page was accessed.
+ accessed = 1uz << 5,
+ //! The page was written to.
+ dirty = 1uz << 6,
+ //! The page is huge.
+ huge_page = 1uz << 7,
+ //! The TLB entry for this page must not be flushed on context switches.
+ //!
+ //! @note This flag is currently not honored by this implementation, since the CR4.PGE bit is not set. As a
+ //! consequence, any CR3 reload or a call to arch::memory::tlb_flush_all will still flush this entry on context
+ //! switches.
+ global = 1uz << 8,
+ //! The data in this page must not be executed.
+ no_execute = 1uz << 63,
};
//! Construct an empty entry.