Fixed Mtypeprotect and MProtect

This commit is contained in:
Antonio 2024-08-08 18:03:09 -04:00
parent 88cbf4128a
commit 61c4096ae1
1 changed files with 15 additions and 16 deletions

View File

@ -300,12 +300,11 @@ s32 PS4_SYSV_ABI sceKernelBatchMap2(OrbisKernelBatchMapEntry* entries, int numEn
if (result == 0) if (result == 0)
processed++; processed++;
} else if (entries[i].operation == } else if (entries[i].operation ==
MemoryOpTypes::ORBIS_KERNEL_MAP_OP_TYPE_PROTECT) { // MPROTECT MemoryOpTypes::ORBIS_KERNEL_MAP_OP_TYPE_PROTECT) { // MTYPEPROTECT
result = sceKernelMTypeProtect(entries[i].start, entries[i].length, entries[i].type, result = sceKernelMTypeProtect(entries[i].start, entries[i].length, entries[i].type,
entries[i].protection); entries[i].protection);
LOG_INFO(Kernel_Vmm, LOG_INFO(Kernel_Vmm, "BatchMap: entry = {}, operation = {}, len = {:#x}, result = {}",
"BatchMap: entry = {}, operation = {}, len = {:#x}, result = {}", i, i, entries[i].operation, entries[i].length, result);
entries[i].operation, entries[i].length, result);
if (result != ORBIS_OK) { if (result != ORBIS_OK) {
LOG_ERROR(Kernel_Vmm, "BatchMap: MProtect failed on entry {} with result {}", i, LOG_ERROR(Kernel_Vmm, "BatchMap: MProtect failed on entry {} with result {}", i,
result); result);
@ -313,10 +312,8 @@ s32 PS4_SYSV_ABI sceKernelBatchMap2(OrbisKernelBatchMapEntry* entries, int numEn
if (result == 0) { if (result == 0) {
processed++; processed++;
} }
} else if (entries[i].operation == } else if (entries[i].operation == MemoryOpTypes::ORBIS_KERNEL_MAP_OP_PROTECT) { // MPROTECT
MemoryOpTypes::ORBIS_KERNEL_MAP_OP_PROTECT) { // MPROTECT result = sceKernelMProtect(entries[i].start, entries[i].length, entries[i].protection);
result = sceKernelMProtect(entries[i].start, entries[i].length,
entries[i].protection);
LOG_INFO(Kernel_Vmm, "BatchMap: entry = {}, operation = {}, len = {:#x}, result = {}", LOG_INFO(Kernel_Vmm, "BatchMap: entry = {}, operation = {}, len = {:#x}, result = {}",
i, entries[i].operation, entries[i].length, result); i, entries[i].operation, entries[i].length, result);
if (result != ORBIS_OK) { if (result != ORBIS_OK) {
@ -340,6 +337,8 @@ s32 PS4_SYSV_ABI sceKernelBatchMap2(OrbisKernelBatchMapEntry* entries, int numEn
UNREACHABLE_MSG("called: Unimplemented Operation = {}", entries[i].operation); UNREACHABLE_MSG("called: Unimplemented Operation = {}", entries[i].operation);
} }
} }
LOG_INFO(Kernel_Vmm, "sceKernelBatchMap2 finished: processed = {}, result = {}", processed,
result);
if (numEntriesOut != NULL) { // can be zero. do not return an error code. if (numEntriesOut != NULL) { // can be zero. do not return an error code.
*numEntriesOut = processed; *numEntriesOut = processed;
} }