aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/memory/scoped_mapping.cpp
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2025-12-02 12:31:53 +0100
committerFelix Morgner <felix.morgner@ost.ch>2025-12-02 12:31:53 +0100
commitbe86be1facfce8fe3f376153b9c582f2c5c026aa (patch)
tree6d05b8ed07fa6afdbbf980fdfdf584e818c1cd61 /arch/x86_64/src/memory/scoped_mapping.cpp
parent203355e51690073e571d4906d53f2494c3dad41b (diff)
downloadkernel-be86be1facfce8fe3f376153b9c582f2c5c026aa.tar.xz
kernel-be86be1facfce8fe3f376153b9c582f2c5c026aa.zip
x86_64/memory: extend scoped_mapping
Diffstat (limited to 'arch/x86_64/src/memory/scoped_mapping.cpp')
-rw-r--r--arch/x86_64/src/memory/scoped_mapping.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/x86_64/src/memory/scoped_mapping.cpp b/arch/x86_64/src/memory/scoped_mapping.cpp
index c436ee5..27c4785 100644
--- a/arch/x86_64/src/memory/scoped_mapping.cpp
+++ b/arch/x86_64/src/memory/scoped_mapping.cpp
@@ -4,6 +4,7 @@
#include "kapi/system.hpp"
#include "x86_64/memory/mmu.hpp"
+#include "x86_64/memory/paging_root.hpp"
#include <utility>
@@ -20,7 +21,12 @@ namespace teachos::memory::x86_64
: m_address{address}
, m_allocator{&allocator}
, m_mapped{false}
- {}
+ {
+ if (paging_root::get().translate(address))
+ {
+ system::panic("[MEM] Tried to map a page that is already mapped!");
+ }
+ }
scoped_mapping::~scoped_mapping()
{