1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 09:18:11 +00:00

Kernel: Stop taking MM lock while using regular quickmaps

You're still required to disable interrupts though, as the mappings are
per-CPU. This exposed the fact that our CR3 lookup map is insufficiently
protected (but we'll address that in a separate commit.)
This commit is contained in:
Andreas Kling 2022-08-22 15:23:32 +02:00
parent c8375c51ff
commit 6cd3695761
5 changed files with 15 additions and 14 deletions

View file

@ -7,11 +7,13 @@
#include <AK/Singleton.h>
#include <Kernel/Arch/InterruptDisabler.h>
#include <Kernel/Memory/PageDirectory.h>
#include <Kernel/Thread.h>
namespace Kernel::Memory {
// FIXME: This needs real locking:
static Singleton<IntrusiveRedBlackTree<&PageDirectory::m_tree_node>> s_cr3_map;
static IntrusiveRedBlackTree<&PageDirectory::m_tree_node>& cr3_map()
@ -22,11 +24,13 @@ static IntrusiveRedBlackTree<&PageDirectory::m_tree_node>& cr3_map()
void PageDirectory::register_page_directory(PageDirectory* directory)
{
InterruptDisabler disabler;
cr3_map().insert(directory->cr3(), *directory);
}
void PageDirectory::deregister_page_directory(PageDirectory* directory)
{
InterruptDisabler disabler;
cr3_map().remove(directory->cr3());
}