From 76e178364a3f4d8617223ded5230b6cf410deeb0 Mon Sep 17 00:00:00 2001 From: Stephen Miller Date: Sun, 22 Jun 2025 11:44:59 -0500 Subject: [PATCH] Fix error returns Based on 11.00 libkernel decomp. --- src/core/libraries/kernel/process.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/core/libraries/kernel/process.cpp b/src/core/libraries/kernel/process.cpp index b8fbd4eca..e22509a3a 100644 --- a/src/core/libraries/kernel/process.cpp +++ b/src/core/libraries/kernel/process.cpp @@ -103,7 +103,7 @@ s32 PS4_SYSV_ABI sceKernelGetModuleInfoForUnwind(VAddr addr, s32 flags, auto* linker = Common::Singleton::Instance(); auto* module = linker->FindByAddress(addr); if (!module) { - return ORBIS_KERNEL_ERROR_EFAULT; + return ORBIS_KERNEL_ERROR_ESRCH; } const auto mod_info = module->GetModuleInfoEx(); @@ -120,12 +120,21 @@ s32 PS4_SYSV_ABI sceKernelGetModuleInfoForUnwind(VAddr addr, s32 flags, s32 PS4_SYSV_ABI sceKernelGetModuleInfoFromAddr(VAddr addr, s32 flags, Core::OrbisKernelModuleInfoEx* info) { + if (flags >= 3) { + std::memset(info, 0, sizeof(Core::OrbisKernelModuleInfoEx)); + return ORBIS_KERNEL_ERROR_EINVAL; + } + if (info == nullptr) { + return ORBIS_KERNEL_ERROR_EFAULT; + } + LOG_INFO(Lib_Kernel, "called addr = {:#x}, flags = {:#x}", addr, flags); auto* linker = Common::Singleton::Instance(); auto* module = linker->FindByAddress(addr); if (!module) { - return ORBIS_KERNEL_ERROR_EFAULT; + return ORBIS_KERNEL_ERROR_ESRCH; } + *info = module->GetModuleInfoEx(); return ORBIS_OK; }