mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-06-25 11:56:18 +00:00
libkernel: Check returned module in sceKernelGetModuleInfoFromAddr (#3147)
* Error if the module doesn't exist Fixes another thing kalaposfos found * Fix error returns Based on 11.00 libkernel decomp.
This commit is contained in:
parent
4bfa8c9fc7
commit
12198f9255
1 changed files with 14 additions and 2 deletions
|
@ -103,7 +103,7 @@ s32 PS4_SYSV_ABI sceKernelGetModuleInfoForUnwind(VAddr addr, s32 flags,
|
|||
auto* linker = Common::Singleton<Core::Linker>::Instance();
|
||||
auto* module = linker->FindByAddress(addr);
|
||||
if (!module) {
|
||||
return ORBIS_KERNEL_ERROR_EFAULT;
|
||||
return ORBIS_KERNEL_ERROR_ESRCH;
|
||||
}
|
||||
const auto mod_info = module->GetModuleInfoEx();
|
||||
|
||||
|
@ -118,11 +118,23 @@ s32 PS4_SYSV_ABI sceKernelGetModuleInfoForUnwind(VAddr addr, s32 flags,
|
|||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceKernelGetModuleInfoFromAddr(VAddr addr, int 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<Core::Linker>::Instance();
|
||||
auto* module = linker->FindByAddress(addr);
|
||||
if (!module) {
|
||||
return ORBIS_KERNEL_ERROR_ESRCH;
|
||||
}
|
||||
|
||||
*info = module->GetModuleInfoEx();
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue