name conversions fixes

This commit is contained in:
wheremyfoodat 2023-08-08 22:44:01 +03:00 committed by georgemoralis
parent 1e361adb72
commit d774ebdaea
5 changed files with 11 additions and 11 deletions

View File

@ -1,5 +1,5 @@
#include "gpu_memory.h" #include "gpu_memory.h"
namespace GPU { namespace GPU {
void GpuMemorySetAllocArea(u64 virtual_addr, u64 size) {} void MemorySetAllocArea(u64 virtual_addr, u64 size) {}
} // namespace GPU } // namespace GPU

View File

@ -3,7 +3,7 @@
#include <types.h> #include <types.h>
namespace GPU { 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);
} }

View File

@ -24,7 +24,7 @@ bool PhysicalMemory::Alloc(u64 searchStart, u64 searchEnd, u64 len, u64 alignmen
block.size = len; block.size = len;
block.start_addr = find_free_pos; block.start_addr = find_free_pos;
block.memoryType = memoryType; block.memoryType = memoryType;
block.gpu_mode = GPU::GPUMemoryMode::NoAccess; block.gpu_mode = GPU::MemoryMode::NoAccess;
block.map_size = 0; block.map_size = 0;
block.map_virtual_addr = 0; block.map_virtual_addr = 0;
block.prot = 0; block.prot = 0;
@ -38,7 +38,7 @@ bool PhysicalMemory::Alloc(u64 searchStart, u64 searchEnd, u64 len, u64 alignmen
return false; 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) { for (auto& b : m_allocatedBlocks) {
if (phys_addr >= b.start_addr && phys_addr < b.start_addr + b.size) { if (phys_addr >= b.start_addr && phys_addr < b.start_addr + b.size) {
if (b.map_virtual_addr != 0 || b.map_size != 0) { if (b.map_virtual_addr != 0 || b.map_size != 0) {

View File

@ -16,14 +16,14 @@ class PhysicalMemory {
u64 map_size; u64 map_size;
int prot; int prot;
VirtualMemory::MemoryMode cpu_mode; VirtualMemory::MemoryMode cpu_mode;
GPU::GPUMemoryMode gpu_mode; GPU::MemoryMode gpu_mode;
}; };
PhysicalMemory() {} PhysicalMemory() {}
virtual ~PhysicalMemory() {} virtual ~PhysicalMemory() {}
public: public:
bool Alloc(u64 searchStart, u64 searchEnd, u64 len, u64 alignment, u64* physAddrOut, int memoryType); 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: private:
std::vector<AllocatedBlock> m_allocatedBlocks; std::vector<AllocatedBlock> m_allocatedBlocks;

View File

@ -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)); LOG_INFO_IF(log_file_memory, "alignment = {}\n", log_hex_full(alignment));
VirtualMemory::MemoryMode cpu_mode = VirtualMemory::MemoryMode::NoAccess; VirtualMemory::MemoryMode cpu_mode = VirtualMemory::MemoryMode::NoAccess;
GPU::GPUMemoryMode gpu_mode = GPU::GPUMemoryMode::NoAccess; GPU::MemoryMode gpu_mode = GPU::MemoryMode::NoAccess;
switch (prot) { switch (prot) {
case 0x33://SCE_KERNEL_PROT_CPU_READ|SCE_KERNEL_PROT_CPU_WRITE|SCE_KERNEL_PROT_GPU_READ|SCE_KERNEL_PROT_GPU_ALL 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; cpu_mode = VirtualMemory::MemoryMode::ReadWrite;
gpu_mode = GPU::GPUMemoryMode::ReadWrite; gpu_mode = GPU::MemoryMode::ReadWrite;
break; break;
default: BREAKPOINT(); default: BREAKPOINT();
} }
@ -120,8 +120,8 @@ int PS4_SYSV_ABI sceKernelMapDirectMemory(void** addr, u64 len, int prot, int fl
BREAKPOINT(); BREAKPOINT();
} }
if (gpu_mode != GPU::GPUMemoryMode::NoAccess) { if (gpu_mode != GPU::MemoryMode::NoAccess) {
GPU::GpuMemorySetAllocArea(out_addr, len); GPU::MemorySetAllocArea(out_addr, len);
} }
return SCE_OK; return SCE_OK;