forked from Bananymous/banan-os
Kernel: PageTableScope locks the PageTable before disabling interrupts
This allows replacing some PageTableScopes with PageTable::lock()
This commit is contained in:
parent
2b9900e56e
commit
96d6453ea8
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <kernel/CriticalScope.h>
|
#include <kernel/CriticalScope.h>
|
||||||
|
#include <kernel/LockGuard.h>
|
||||||
#include <kernel/Memory/PageTable.h>
|
#include <kernel/Memory/PageTable.h>
|
||||||
|
|
||||||
namespace Kernel
|
namespace Kernel
|
||||||
|
@ -10,7 +11,8 @@ namespace Kernel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PageTableScope(PageTable& page_table)
|
PageTableScope(PageTable& page_table)
|
||||||
: m_old(PageTable::current())
|
: m_guard(page_table)
|
||||||
|
, m_old(PageTable::current())
|
||||||
, m_temp(page_table)
|
, m_temp(page_table)
|
||||||
{
|
{
|
||||||
if (&m_old != &m_temp)
|
if (&m_old != &m_temp)
|
||||||
|
@ -22,6 +24,7 @@ namespace Kernel
|
||||||
m_old.load();
|
m_old.load();
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
|
LockGuard<PageTable> m_guard;
|
||||||
CriticalScope m_scope;
|
CriticalScope m_scope;
|
||||||
PageTable& m_old;
|
PageTable& m_old;
|
||||||
PageTable& m_temp;
|
PageTable& m_temp;
|
||||||
|
|
Loading…
Reference in New Issue