mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
a4534678f9
Now that the code does not use architectural specific code, it is moved to the generic Arch directory and the paths are modified accordingly.
27 lines
669 B
C++
27 lines
669 B
C++
/*
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <Kernel/Arch/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();
|
|
Memory::MemoryManager::enter_process_address_space(process);
|
|
}
|
|
|
|
ScopedAddressSpaceSwitcher::~ScopedAddressSpaceSwitcher()
|
|
{
|
|
InterruptDisabler disabler;
|
|
Thread::current()->regs().cr3 = m_previous_cr3;
|
|
write_cr3(m_previous_cr3);
|
|
}
|
|
|
|
}
|