summaryrefslogtreecommitdiff
path: root/Kernel/VM/MemoryManager.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-02-16 01:27:42 +0100
committerAndreas Kling <kling@serenityos.org>2020-02-16 01:27:42 +0100
commita356e4815098e5398e103aa69865bd6c88f7ad36 (patch)
tree50437c6444405f12671bce7f04a8c1b10cff70f8 /Kernel/VM/MemoryManager.cpp
parentd42f0f46616168bdff492f880b3ea432a49f7345 (diff)
downloadserenity-a356e4815098e5398e103aa69865bd6c88f7ad36.zip
Kernel: Move all code into the Kernel namespace
Diffstat (limited to 'Kernel/VM/MemoryManager.cpp')
-rw-r--r--Kernel/VM/MemoryManager.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp
index a4433ed036..86122d83e7 100644
--- a/Kernel/VM/MemoryManager.cpp
+++ b/Kernel/VM/MemoryManager.cpp
@@ -39,6 +39,12 @@
//#define MM_DEBUG
//#define PAGE_FAULT_DEBUG
+extern uintptr_t start_of_kernel_text;
+extern uintptr_t start_of_kernel_data;
+extern uintptr_t end_of_kernel_bss;
+
+namespace Kernel {
+
static MemoryManager* s_the;
MemoryManager& MM
@@ -64,8 +70,6 @@ MemoryManager::~MemoryManager()
void MemoryManager::protect_kernel_image()
{
// Disable writing to the kernel text and rodata segments.
- extern uintptr_t start_of_kernel_text;
- extern uintptr_t start_of_kernel_data;
for (size_t i = (uintptr_t)&start_of_kernel_text; i < (uintptr_t)&start_of_kernel_data; i += PAGE_SIZE) {
auto& pte = ensure_pte(kernel_page_directory(), VirtualAddress(i));
pte.set_writable(false);
@@ -73,7 +77,6 @@ void MemoryManager::protect_kernel_image()
if (g_cpu_supports_nx) {
// Disable execution of the kernel data and bss segments.
- extern uintptr_t end_of_kernel_bss;
for (size_t i = (uintptr_t)&start_of_kernel_data; i < (uintptr_t)&end_of_kernel_bss; i += PAGE_SIZE) {
auto& pte = ensure_pte(kernel_page_directory(), VirtualAddress(i));
pte.set_execute_disabled(true);
@@ -681,3 +684,5 @@ ProcessPagingScope::~ProcessPagingScope()
current->tss().cr3 = m_previous_cr3;
write_cr3(m_previous_cr3);
}
+
+}