1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:18:11 +00:00

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

View file

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