1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:57:44 +00:00

Kernel: Always remove PageDirectories from the cr3 map on destruction

Previously we would only remove them from the map if they were attached
to an AddressSpace, even though we would always add them to the map on
construction. This results in an assertion failure on destruction if
the page directory was never attached to an AddressSpace. (for example,
on an allocation failure of said AddressSpace)
This commit is contained in:
Idan Horowitz 2022-01-15 04:16:11 +02:00 committed by Andreas Kling
parent 1678dcbf91
commit 6e37487477

View file

@ -151,8 +151,7 @@ UNMAP_AFTER_INIT void PageDirectory::allocate_kernel_directory()
PageDirectory::~PageDirectory()
{
SpinlockLocker lock(s_mm_lock);
if (m_space)
cr3_map().remove(cr3());
cr3_map().remove(cr3());
}
}