Kernel: PageTableScope locks the PageTable before disabling interrupts

This allows replacing some PageTableScopes with PageTable::lock()
This commit is contained in:
Bananymous 2023-06-09 00:34:41 +03:00
parent 2b9900e56e
commit 96d6453ea8
1 changed files with 4 additions and 1 deletions

View File

@ -1,6 +1,7 @@
#pragma once
#include <kernel/CriticalScope.h>
#include <kernel/LockGuard.h>
#include <kernel/Memory/PageTable.h>
namespace Kernel
@ -10,7 +11,8 @@ namespace Kernel
{
public:
PageTableScope(PageTable& page_table)
: m_old(PageTable::current())
: m_guard(page_table)
, m_old(PageTable::current())
, m_temp(page_table)
{
if (&m_old != &m_temp)
@ -22,6 +24,7 @@ namespace Kernel
m_old.load();
}
private:
LockGuard<PageTable> m_guard;
CriticalScope m_scope;
PageTable& m_old;
PageTable& m_temp;