1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 06:37:36 +00:00

Kernel: Switch singletons to use new Singleton class

Fixes #3226
This commit is contained in:
Tom 2020-08-20 09:36:06 -06:00 committed by Andreas Kling
parent 527c8047fe
commit f48feae0b2
44 changed files with 184 additions and 146 deletions

View file

@ -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)