PhysicalMemory is now singleton
This commit is contained in:
parent
dcac8c1661
commit
7bc4fda33e
|
@ -6,13 +6,16 @@
|
||||||
#include "MemMngCodes.h"
|
#include "MemMngCodes.h"
|
||||||
#include <bit>
|
#include <bit>
|
||||||
#include "PhysicalMemory.h"
|
#include "PhysicalMemory.h"
|
||||||
|
#include "../../../../Util/Singleton.h"
|
||||||
|
|
||||||
namespace HLE::Libs::LibKernel::MemoryManagement {
|
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); }
|
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);
|
LOG_INFO_IF(true, "memory_type = {}\n", memoryType);
|
||||||
|
|
||||||
u64 physical_addr = 0;
|
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
|
//TODO debug logging
|
||||||
return SCE_KERNEL_ERROR_EAGAIN;
|
return SCE_KERNEL_ERROR_EAGAIN;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,12 +4,15 @@
|
||||||
#include "../../../Debug.h"
|
#include "../../../Debug.h"
|
||||||
#include "../../../Util/Log.h"
|
#include "../../../Util/Log.h"
|
||||||
#include "Kernel/MemoryManagement.h"
|
#include "Kernel/MemoryManagement.h"
|
||||||
|
#include "Kernel/PhysicalMemory.h"
|
||||||
|
#include "../../../Util/Singleton.h"
|
||||||
|
|
||||||
namespace HLE::Libs::LibKernel {
|
namespace HLE::Libs::LibKernel {
|
||||||
|
|
||||||
static u64 g_stack_chk_guard = 0xDEADBEEF54321ABC; //dummy return
|
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) {
|
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();
|
BREAKPOINT();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue