Kernel: Only clone the bottom 2MB of mappings from kernel to processes

This commit is contained in:
Andreas Kling 2020-01-17 22:32:34 +01:00
parent 122c76d7fa
commit 536c0ff3ee
Notes: sideshowbarker 2024-07-19 10:00:15 +09:00

View file

@ -62,12 +62,12 @@ PageDirectory::PageDirectory(Process& process, const RangeAllocator* parent_rang
MM.unquickmap_page(); MM.unquickmap_page();
} }
// Clone bottom 8 MB of mappings from kernel_page_directory // Clone bottom 2 MB of mappings from kernel_page_directory
PageDirectoryEntry buffer[4]; PageDirectoryEntry buffer;
auto* kernel_pd = MM.quickmap_pd(MM.kernel_page_directory(), 0); auto* kernel_pd = MM.quickmap_pd(MM.kernel_page_directory(), 0);
memcpy(buffer, kernel_pd, sizeof(PageDirectoryEntry) * 4); memcpy(&buffer, kernel_pd, sizeof(PageDirectoryEntry));
auto* new_pd = MM.quickmap_pd(*this, 0); auto* new_pd = MM.quickmap_pd(*this, 0);
memcpy(new_pd, buffer, sizeof(PageDirectoryEntry) * 4); memcpy(new_pd, &buffer, sizeof(PageDirectoryEntry));
InterruptDisabler disabler; InterruptDisabler disabler;
cr3_map().set(cr3(), this); cr3_map().set(cr3(), this);