initial work on sceKernelMapDirectMemory

This commit is contained in:
georgemoralis 2023-08-03 14:18:55 +03:00
parent 53ce038893
commit 8b78cc1dec
2 changed files with 21 additions and 0 deletions

View File

@ -64,7 +64,14 @@ int PS4_SYSV_ABI sceKernelAllocateDirectMemory(s64 searchStart, s64 searchEnd, u
} }
int PS4_SYSV_ABI sceKernelMapDirectMemory(void** addr, u64 len, int prot, int flags, s64 directMemoryStart, u64 alignment) { int PS4_SYSV_ABI sceKernelMapDirectMemory(void** addr, u64 len, int prot, int flags, s64 directMemoryStart, u64 alignment) {
PRINT_FUNCTION_NAME();
auto* physical_memory = Singleton<HLE::Kernel::Objects::PhysicalMemory>::Instance(); auto* physical_memory = Singleton<HLE::Kernel::Objects::PhysicalMemory>::Instance();
LOG_INFO_IF(log_file_memory, "len = {}\n", log_hex_full(len));
LOG_INFO_IF(log_file_memory, "prot = {}\n", log_hex_full(prot));
LOG_INFO_IF(log_file_memory, "flags = {}\n", log_hex_full(flags));
LOG_INFO_IF(log_file_memory, "directMemoryStart = {}\n", log_hex_full(directMemoryStart));
LOG_INFO_IF(log_file_memory, "alignment = {}\n", log_hex_full(alignment));
BREAKPOINT(); BREAKPOINT();
return SCE_OK; return SCE_OK;
} }

View File

@ -14,6 +14,20 @@ enum MemoryTypes : u32 {
SCE_KERNEL_WB_GARLIC = 10 // write - back mode (Garlic bus) SCE_KERNEL_WB_GARLIC = 10 // write - back mode (Garlic bus)
}; };
enum MemoryFlags : u32 {
NOT_SPECIFIED = 0, // not in SCE but it is a possible value (aligned memory)
SCE_KERNEL_MAP_FIXED = 0x0010, // Fixed
SCE_KERNEL_MAP_NO_OVERWRITE = 0x0080,
SCE_KERNEL_MAP_NO_COALESCE = 0x400000
};
enum MemoryProtection : u32 {
SCE_KERNEL_PROT_CPU_READ = 0x01, // Permit reads from the CPU
SCE_KERNEL_PROT_CPU_RW = 0x02, // Permit reads/writes from the CPU
SCE_KERNEL_PROT_CPU_WRITE = 0x02, // Permit reads/writes from the CPU (same)
SCE_KERNEL_PROT_GPU_READ = 0x10, // Permit reads from the GPU
SCE_KERNEL_PROT_GPU_WRITE = 0x20, // Permit writes from the GPU
SCE_KERNEL_PROT_GPU_RW = 0x30 // Permit reads/writes from the GPU
};
namespace HLE::Libs::LibKernel::MemoryManagement { namespace HLE::Libs::LibKernel::MemoryManagement {
u64 PS4_SYSV_ABI sceKernelGetDirectMemorySize(); u64 PS4_SYSV_ABI sceKernelGetDirectMemorySize();