summaryrefslogtreecommitdiff
path: root/Kernel/VM/MemoryManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/VM/MemoryManager.cpp')
-rw-r--r--Kernel/VM/MemoryManager.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp
index c39735225e..977285dcd8 100644
--- a/Kernel/VM/MemoryManager.cpp
+++ b/Kernel/VM/MemoryManager.cpp
@@ -39,6 +39,7 @@
#include <Kernel/VM/PhysicalRegion.h>
#include <Kernel/VM/PurgeableVMObject.h>
#include <Kernel/VM/SharedInodeVMObject.h>
+#include <Kernel/Singleton.h>
#include <Kernel/StdLib.h>
//#define MM_DEBUG
@@ -50,7 +51,7 @@ extern FlatPtr end_of_kernel_bss;
namespace Kernel {
-static MemoryManager* s_the;
+static auto s_the = make_singleton<MemoryManager>();
RecursiveSpinLock s_mm_lock;
MemoryManager& MM
@@ -60,6 +61,8 @@ MemoryManager& MM
MemoryManager::MemoryManager()
{
+ ASSERT(!s_the.is_initialized());
+
ScopedSpinLock lock(s_mm_lock);
m_kernel_page_directory = PageDirectory::create_kernel_page_directory();
parse_memory_map();
@@ -217,7 +220,7 @@ void MemoryManager::initialize(u32 cpu)
Processor::current().set_mm_data(*mm_data);
if (cpu == 0)
- s_the = new MemoryManager;
+ s_the.ensure_instance();
}
Region* MemoryManager::kernel_region_from_vaddr(VirtualAddress vaddr)