From 9da52040798d8180a0c218e3ceddf2c745f0f3cf Mon Sep 17 00:00:00 2001 From: apio Date: Mon, 27 Feb 2023 12:30:52 +0100 Subject: [PATCH] x86_64/MMU: Copy from the mapped kernel directory instead of the physical version --- kernel/src/arch/x86_64/MMU.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/src/arch/x86_64/MMU.cpp b/kernel/src/arch/x86_64/MMU.cpp index 2f85f238..0e04332b 100644 --- a/kernel/src/arch/x86_64/MMU.cpp +++ b/kernel/src/arch/x86_64/MMU.cpp @@ -288,7 +288,8 @@ namespace MMU constexpr auto HALF_PAGE = ARCH_PAGE_SIZE / 2; // Copy the upper part of the page directory (higher half) - memcpy(offset_ptr(directory, HALF_PAGE), offset_ptr(g_kernel_directory, HALF_PAGE), HALF_PAGE); + memcpy(offset_ptr(directory, HALF_PAGE), offset_ptr((PageDirectory*)g_kernel_directory_virt, HALF_PAGE), + HALF_PAGE); kdbgln("MMU init page directory (ring3): virt %p, phys %#.16lx", directory, directory_phys);