name conversions fixes
This commit is contained in:
parent
1e361adb72
commit
d774ebdaea
|
@ -1,5 +1,5 @@
|
|||
#include "gpu_memory.h"
|
||||
|
||||
namespace GPU {
|
||||
void GpuMemorySetAllocArea(u64 virtual_addr, u64 size) {}
|
||||
void MemorySetAllocArea(u64 virtual_addr, u64 size) {}
|
||||
} // namespace GPU
|
|
@ -3,7 +3,7 @@
|
|||
#include <types.h>
|
||||
|
||||
namespace GPU {
|
||||
enum class GPUMemoryMode : u32 { NoAccess = 0, Read = 1, Write = 2, ReadWrite = 3 };
|
||||
enum class MemoryMode : u32 { NoAccess = 0, Read = 1, Write = 2, ReadWrite = 3 };
|
||||
|
||||
void GpuMemorySetAllocArea(u64 virtual_addr, u64 size);
|
||||
void MemorySetAllocArea(u64 virtual_addr, u64 size);
|
||||
}
|
|
@ -24,7 +24,7 @@ bool PhysicalMemory::Alloc(u64 searchStart, u64 searchEnd, u64 len, u64 alignmen
|
|||
block.size = len;
|
||||
block.start_addr = find_free_pos;
|
||||
block.memoryType = memoryType;
|
||||
block.gpu_mode = GPU::GPUMemoryMode::NoAccess;
|
||||
block.gpu_mode = GPU::MemoryMode::NoAccess;
|
||||
block.map_size = 0;
|
||||
block.map_virtual_addr = 0;
|
||||
block.prot = 0;
|
||||
|
@ -38,7 +38,7 @@ bool PhysicalMemory::Alloc(u64 searchStart, u64 searchEnd, u64 len, u64 alignmen
|
|||
|
||||
return false;
|
||||
}
|
||||
bool PhysicalMemory::Map(u64 virtual_addr, u64 phys_addr, u64 len, int prot, VirtualMemory::MemoryMode cpu_mode, GPU::GPUMemoryMode gpu_mode) {
|
||||
bool PhysicalMemory::Map(u64 virtual_addr, u64 phys_addr, u64 len, int prot, VirtualMemory::MemoryMode cpu_mode, GPU::MemoryMode gpu_mode) {
|
||||
for (auto& b : m_allocatedBlocks) {
|
||||
if (phys_addr >= b.start_addr && phys_addr < b.start_addr + b.size) {
|
||||
if (b.map_virtual_addr != 0 || b.map_size != 0) {
|
||||
|
|
|
@ -16,14 +16,14 @@ class PhysicalMemory {
|
|||
u64 map_size;
|
||||
int prot;
|
||||
VirtualMemory::MemoryMode cpu_mode;
|
||||
GPU::GPUMemoryMode gpu_mode;
|
||||
GPU::MemoryMode gpu_mode;
|
||||
};
|
||||
PhysicalMemory() {}
|
||||
virtual ~PhysicalMemory() {}
|
||||
|
||||
public:
|
||||
bool Alloc(u64 searchStart, u64 searchEnd, u64 len, u64 alignment, u64* physAddrOut, int memoryType);
|
||||
bool Map(u64 virtual_addr, u64 phys_addr, u64 len, int prot, VirtualMemory::MemoryMode cpu_mode, GPU::GPUMemoryMode gpu_mode);
|
||||
bool Map(u64 virtual_addr, u64 phys_addr, u64 len, int prot, VirtualMemory::MemoryMode cpu_mode, GPU::MemoryMode gpu_mode);
|
||||
|
||||
private:
|
||||
std::vector<AllocatedBlock> m_allocatedBlocks;
|
||||
|
|
|
@ -91,12 +91,12 @@ int PS4_SYSV_ABI sceKernelMapDirectMemory(void** addr, u64 len, int prot, int fl
|
|||
LOG_INFO_IF(log_file_memory, "alignment = {}\n", log_hex_full(alignment));
|
||||
|
||||
VirtualMemory::MemoryMode cpu_mode = VirtualMemory::MemoryMode::NoAccess;
|
||||
GPU::GPUMemoryMode gpu_mode = GPU::GPUMemoryMode::NoAccess;
|
||||
GPU::MemoryMode gpu_mode = GPU::MemoryMode::NoAccess;
|
||||
|
||||
switch (prot) {
|
||||
case 0x33://SCE_KERNEL_PROT_CPU_READ|SCE_KERNEL_PROT_CPU_WRITE|SCE_KERNEL_PROT_GPU_READ|SCE_KERNEL_PROT_GPU_ALL
|
||||
cpu_mode = VirtualMemory::MemoryMode::ReadWrite;
|
||||
gpu_mode = GPU::GPUMemoryMode::ReadWrite;
|
||||
gpu_mode = GPU::MemoryMode::ReadWrite;
|
||||
break;
|
||||
default: BREAKPOINT();
|
||||
}
|
||||
|
@ -120,8 +120,8 @@ int PS4_SYSV_ABI sceKernelMapDirectMemory(void** addr, u64 len, int prot, int fl
|
|||
BREAKPOINT();
|
||||
}
|
||||
|
||||
if (gpu_mode != GPU::GPUMemoryMode::NoAccess) {
|
||||
GPU::GpuMemorySetAllocArea(out_addr, len);
|
||||
if (gpu_mode != GPU::MemoryMode::NoAccess) {
|
||||
GPU::MemorySetAllocArea(out_addr, len);
|
||||
}
|
||||
|
||||
return SCE_OK;
|
||||
|
|
Loading…
Reference in New Issue