mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-01 12:07:31 +01:00
Kernel: Match GetModuleIdList and heap allocation to hardware
pspautotests modules/idlist shows that sceKernelGetModuleIdList still writes a partial entry at the end of the buffer (a size of 6 gives two entries), which the previous commit had stopped. A NULL buffer or a negative size returns ILLEGAL_ADDR without writing the count. sysmem/kernel/heap shows sceKernelAllocHeapMemory returning null for sizes near 4GB, rather than wrapping. The WithOption variant already checked this. The plain one now does too. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
22b6fcbf22
commit
e9fa393546
4 files changed
+14
-8
No files matched your search
@@ -3838,8 +3838,12 @@ static u32 sceKernelQueryModuleInfo(u32 uid, u32 infoAddr)
|
||||
|
||||
static u32 sceKernelGetModuleIdList(u32 resultBuffer, u32 resultBufferSize, u32 idCountAddr)
|
||||
{
|
||||
ERROR_LOG(Log::sceModule, "UNTESTED sceKernelGetModuleIdList(%08x, %i, %08x)", resultBuffer, resultBufferSize, idCountAddr);
|
||||
|
||||
// pspautotests modules/idlist: the size is in bytes, a partial entry at the end still gets
|
||||
// written, and the count covers every module whether it fit or not.
|
||||
if (resultBuffer == 0 || (int)resultBufferSize < 0) {
|
||||
return hleLogError(Log::sceModule, SCE_KERNEL_ERROR_ILLEGAL_ADDR, "bad buffer");
|
||||
}
|
||||
|
||||
int idCount = 0;
|
||||
u32 resultBufferOffset = 0;
|
||||
|
||||
@@ -3850,8 +3854,7 @@ static u32 sceKernelGetModuleIdList(u32 resultBuffer, u32 resultBufferSize, u32
|
||||
continue;
|
||||
}
|
||||
if (!module->isFake || liedAboutThisModule(module)) {
|
||||
// Only whole entries.
|
||||
if (resultBufferOffset + 4 <= resultBufferSize) {
|
||||
if (resultBufferOffset < resultBufferSize) {
|
||||
Memory::WriteOrException_U32(module->GetUID(), resultBuffer + resultBufferOffset);
|
||||
resultBufferOffset += 4;
|
||||
}
|
||||
@@ -3860,8 +3863,7 @@ static u32 sceKernelGetModuleIdList(u32 resultBuffer, u32 resultBufferSize, u32
|
||||
}
|
||||
|
||||
Memory::WriteOrException_U32(idCount, idCountAddr);
|
||||
|
||||
return hleNoLog(0);
|
||||
return hleLogDebug(Log::sceModule, 0);
|
||||
}
|
||||
|
||||
bool DescribeModuleAddress(u32 address, char *buffer, size_t bufferSize) {
|
||||
|
||||
Reference in new issue
Block a user