From 1320b9351eca7e059787fd93a721b1c607a8a456 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 31 Jan 2021 19:00:53 +0100 Subject: [PATCH] Revert "Kernel: Don't clone kernel mappings for bottom 2 MiB VM into processes" This reverts commit da7b21dc06d733c30eb9912b9b64e82b02f31671. This broke SMP boot, oops! :^) --- Kernel/VM/PageDirectory.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Kernel/VM/PageDirectory.cpp b/Kernel/VM/PageDirectory.cpp index 0a02e7232b..939853810f 100644 --- a/Kernel/VM/PageDirectory.cpp +++ b/Kernel/VM/PageDirectory.cpp @@ -135,6 +135,13 @@ PageDirectory::PageDirectory(Process& process, const RangeAllocator* parent_rang MM.unquickmap_page(); } + // Clone bottom 2 MiB of mappings from kernel_page_directory + PageDirectoryEntry buffer; + auto* kernel_pd = MM.quickmap_pd(MM.kernel_page_directory(), 0); + memcpy(&buffer, kernel_pd, sizeof(PageDirectoryEntry)); + auto* new_pd = MM.quickmap_pd(*this, 0); + memcpy(new_pd, &buffer, sizeof(PageDirectoryEntry)); + // If we got here, we successfully created it. Set m_process now m_process = &process;