mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
a1d7ebf85a
This directory isn't just about virtual memory, it's about all kinds of memory management.
27 lines
612 B
C++
27 lines
612 B
C++
/*
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <Kernel/Arch/x86/InterruptDisabler.h>
|
|
#include <Kernel/Memory/MemoryManager.h>
|
|
#include <Kernel/Memory/ProcessPagingScope.h>
|
|
|
|
namespace Kernel {
|
|
|
|
ProcessPagingScope::ProcessPagingScope(Process& process)
|
|
{
|
|
VERIFY(Thread::current() != nullptr);
|
|
m_previous_cr3 = read_cr3();
|
|
MM.enter_process_paging_scope(process);
|
|
}
|
|
|
|
ProcessPagingScope::~ProcessPagingScope()
|
|
{
|
|
InterruptDisabler disabler;
|
|
Thread::current()->regs().cr3 = m_previous_cr3;
|
|
write_cr3(m_previous_cr3);
|
|
}
|
|
|
|
}
|