improved vaddr conversion

This commit is contained in:
georgemoralis 2024-07-29 15:31:59 +03:00
parent f4b59d9fd2
commit 9b796efabc
2 changed files with 3 additions and 4 deletions

View File

@ -274,7 +274,7 @@ s32 PS4_SYSV_ABI sceKernelBatchMap2(OrbisKernelBatchMapEntry* entries, int numEn
return result; return result;
} }
s32 PS4_SYSV_ABI sceKernelSetVirtualRangeName(void* addr, size_t len, const char* name) { s32 PS4_SYSV_ABI sceKernelSetVirtualRangeName(const void* addr, size_t len, const char* name) {
static constexpr size_t MaxNameSize = 32; static constexpr size_t MaxNameSize = 32;
if (std::strlen(name) > MaxNameSize) { if (std::strlen(name) > MaxNameSize) {
LOG_ERROR(Kernel_Vmm, "name exceeds 32 bytes!"); LOG_ERROR(Kernel_Vmm, "name exceeds 32 bytes!");
@ -286,8 +286,7 @@ s32 PS4_SYSV_ABI sceKernelSetVirtualRangeName(void* addr, size_t len, const char
return ORBIS_KERNEL_ERROR_EFAULT; return ORBIS_KERNEL_ERROR_EFAULT;
} }
auto* memory = Core::Memory::Instance(); auto* memory = Core::Memory::Instance();
const VAddr vaddr = reinterpret_cast<VAddr>(addr); memory->NameVirtualRange(std::bit_cast<VAddr>(addr), len, name);
memory->NameVirtualRange(vaddr, len, name);
return ORBIS_OK; return ORBIS_OK;
} }
} // namespace Libraries::Kernel } // namespace Libraries::Kernel

View File

@ -108,6 +108,6 @@ s32 PS4_SYSV_ABI sceKernelBatchMap(OrbisKernelBatchMapEntry* entries, int numEnt
s32 PS4_SYSV_ABI sceKernelBatchMap2(OrbisKernelBatchMapEntry* entries, int numEntries, s32 PS4_SYSV_ABI sceKernelBatchMap2(OrbisKernelBatchMapEntry* entries, int numEntries,
int* numEntriesOut, int flags); int* numEntriesOut, int flags);
s32 PS4_SYSV_ABI sceKernelSetVirtualRangeName(void* addr, size_t len, const char* name); s32 PS4_SYSV_ABI sceKernelSetVirtualRangeName(const void* addr, size_t len, const char* name);
} // namespace Libraries::Kernel } // namespace Libraries::Kernel