blob: a9a4dbd1a90e9225ecd2f72ed4f30632d1c97486 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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/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);
}
}
|