aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-04-08 13:54:52 +0200
committerFelix Morgner <felix.morgner@ost.ch>2026-04-08 13:54:52 +0200
commit878852c94c4d56f303366cec177b3edef9b3b9c5 (patch)
treeb7c33b89201f6a8ae55fdc4ba041c4f1b9b97f99 /arch
parent0bbec5ceba0df5668ab1aedcbf2905bf599f6eba (diff)
downloadteachos-878852c94c4d56f303366cec177b3edef9b3b9c5.tar.xz
teachos-878852c94c4d56f303366cec177b3edef9b3b9c5.zip
kapi: add basic support for MMIO mapping
Diffstat (limited to 'arch')
-rw-r--r--arch/x86_64/include/arch/memory/page_table.hpp6
-rw-r--r--arch/x86_64/kapi/memory.cpp1
2 files changed, 4 insertions, 3 deletions
diff --git a/arch/x86_64/include/arch/memory/page_table.hpp b/arch/x86_64/include/arch/memory/page_table.hpp
index 3cbb0af..c75ccaf 100644
--- a/arch/x86_64/include/arch/memory/page_table.hpp
+++ b/arch/x86_64/include/arch/memory/page_table.hpp
@@ -174,7 +174,7 @@ namespace arch::memory
result |= mapper_flags::writable;
}
- if ((flags & table_flags::disable_cache) != table_flags::empty)
+ if ((flags & (table_flags::disable_cache | table_flags::write_through)) != table_flags::empty)
{
result |= mapper_flags::uncached;
}
@@ -211,7 +211,7 @@ namespace arch::memory
if ((flags & mapper_flags::uncached) != mapper_flags::empty)
{
- result |= table_flags::disable_cache;
+ result |= (table_flags::disable_cache | table_flags::write_through);
}
if ((flags & mapper_flags::supervisor_only) == mapper_flags::empty)
@@ -229,4 +229,4 @@ namespace arch::memory
} // namespace arch::memory
-#endif \ No newline at end of file
+#endif
diff --git a/arch/x86_64/kapi/memory.cpp b/arch/x86_64/kapi/memory.cpp
index 5f12e5c..853639c 100644
--- a/arch/x86_64/kapi/memory.cpp
+++ b/arch/x86_64/kapi/memory.cpp
@@ -245,6 +245,7 @@ namespace kapi::memory
[](auto const & region) { return region.base + region.size_in_B; }));
init_pmm(frame::containing(physical_address{highest_byte}).number() + 1, handoff_to_kernel_pmm);
+ init_mmio(mmio_base, 1_GiB / page::size);
kstd::println("[x86_64:MEM] Releasing bootstrap memory allocators.");
region_based_allocator.reset();