mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 16:38:10 +00:00
Kernel: Rename ProcessPagingScope => ScopedAddressSpaceSwitcher
This commit is contained in:
parent
cd8d52e6ae
commit
f16b9a691f
8 changed files with 24 additions and 24 deletions
27
Kernel/Memory/ScopedAddressSpaceSwitcher.cpp
Normal file
27
Kernel/Memory/ScopedAddressSpaceSwitcher.cpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* 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/ScopedAddressSpaceSwitcher.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
ScopedAddressSpaceSwitcher::ScopedAddressSpaceSwitcher(Process& process)
|
||||
{
|
||||
VERIFY(Thread::current() != nullptr);
|
||||
m_previous_cr3 = read_cr3();
|
||||
MM.enter_process_address_space(process);
|
||||
}
|
||||
|
||||
ScopedAddressSpaceSwitcher::~ScopedAddressSpaceSwitcher()
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
Thread::current()->regs().cr3 = m_previous_cr3;
|
||||
write_cr3(m_previous_cr3);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue