diff --git a/src/Core/PS4/HLE/Kernel/MemoryManagement.cpp b/src/Core/PS4/HLE/Kernel/MemoryManagement.cpp index 9ea98670..0975a986 100644 --- a/src/Core/PS4/HLE/Kernel/MemoryManagement.cpp +++ b/src/Core/PS4/HLE/Kernel/MemoryManagement.cpp @@ -6,13 +6,16 @@ #include "MemMngCodes.h" #include #include "PhysicalMemory.h" +#include "../../../../Util/Singleton.h" namespace HLE::Libs::LibKernel::MemoryManagement { -static PhysicalMemory* g_physical_memory = nullptr; +//static PhysicalMemory* g_physical_memory = nullptr; -void PhysicalMemoryInit() { g_physical_memory = new PhysicalMemory; } +void PhysicalMemoryInit() { /* + g_physical_memory = new PhysicalMemory;*/ +} static u64 align_pos(u64 pos, u64 align) { return (align != 0 ? (pos + (align - 1)) & ~(align - 1) : pos); } @@ -85,7 +88,8 @@ int PS4_SYSV_ABI sceKernelAllocateDirectMemory(s64 searchStart, s64 searchEnd, u LOG_INFO_IF(true, "memory_type = {}\n", memoryType); u64 physical_addr = 0; - if (!g_physical_memory->Alloc(searchStart, searchEnd, len, alignment, &physical_addr, memoryType)) { + auto* physical_memory = Singleton::Instance(); + if (!physical_memory->Alloc(searchStart, searchEnd, len, alignment, &physical_addr, memoryType)) { //TODO debug logging return SCE_KERNEL_ERROR_EAGAIN; } diff --git a/src/Core/PS4/HLE/LibKernel.cpp b/src/Core/PS4/HLE/LibKernel.cpp index 81272194..4395747e 100644 --- a/src/Core/PS4/HLE/LibKernel.cpp +++ b/src/Core/PS4/HLE/LibKernel.cpp @@ -4,12 +4,15 @@ #include "../../../Debug.h" #include "../../../Util/Log.h" #include "Kernel/MemoryManagement.h" +#include "Kernel/PhysicalMemory.h" +#include "../../../Util/Singleton.h" namespace HLE::Libs::LibKernel { static u64 g_stack_chk_guard = 0xDEADBEEF54321ABC; //dummy return int32_t PS4_SYSV_ABI sceKernelMapDirectMemory(void** addr, size_t len, int prot, int flags, off_t directMemoryStart, size_t alignment) { + auto* physical_memory = Singleton::Instance(); BREAKPOINT(); return 0; }