mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-12-03 08:40:44 +00:00
PhysicalMemory is now singleton
This commit is contained in:
parent
dcac8c1661
commit
7bc4fda33e
@ -6,13 +6,16 @@
|
||||
#include "MemMngCodes.h"
|
||||
#include <bit>
|
||||
#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<HLE::Libs::LibKernel::MemoryManagement::PhysicalMemory>::Instance();
|
||||
if (!physical_memory->Alloc(searchStart, searchEnd, len, alignment, &physical_addr, memoryType)) {
|
||||
//TODO debug logging
|
||||
return SCE_KERNEL_ERROR_EAGAIN;
|
||||
}
|
||||
|
@ -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<HLE::Libs::LibKernel::MemoryManagement::PhysicalMemory>::Instance();
|
||||
BREAKPOINT();
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user