Module: Correctly handle modules with -1 entry.

It should not try to run, options or not.
This commit is contained in:
Unknown W. Brackets committed 2021-03-14 16:52:48 -07:00
1 parent 3b1c02fa49
commit f6ad90fab8
2 files changed
+5 -12

No files matched your search

+3 -11
View File
@@ -2085,16 +2085,6 @@ int KernelStartModule(SceUID moduleId, u32 argsize, u32 argAddr, u32 returnValue
entryAddr = module->nm.module_start_func;
if (module->nm.module_start_thread_attr != 0)
attribute = module->nm.module_start_thread_attr;
} else if (entryAddr == (u32)-1 || entryAddr == module->memoryBlockAddr - 1) {
if (smoption) {
// TODO: Does sceKernelStartModule() really give an error when no entry only if you pass options?
attribute = smoption->attribute;
} else {
// TODO: Why are we just returning the module ID in this case?
WARN_LOG(SCEMODULE, "sceKernelStartModule(): module has no start or entry func");
module->nm.status = MODULE_STATUS_STARTED;
return moduleId;
}
}
if (Memory::IsValidAddress(entryAddr)) {
@@ -2110,6 +2100,8 @@ int KernelStartModule(SceUID moduleId, u32 argsize, u32 argAddr, u32 returnValue
stacksize = module->nm.module_start_thread_stacksize;
}
// TODO: Why do we skip smoption->attribute here?
SceUID threadID = __KernelCreateThread(module->nm.name, moduleId, entryAddr, priority, stacksize, attribute, 0, (module->nm.attribute & 0x1000) != 0);
__KernelStartThreadValidate(threadID, argsize, argAddr);
__KernelSetThreadRA(threadID, NID_MODULERETURN);
@@ -2117,7 +2109,7 @@ int KernelStartModule(SceUID moduleId, u32 argsize, u32 argAddr, u32 returnValue
if (needsWait) {
*needsWait = true;
}
} else if (entryAddr == 0) {
} else if (entryAddr == 0 || entryAddr == (u32)-1) {
INFO_LOG(SCEMODULE, "sceKernelStartModule(%d,asize=%08x,aptr=%08x,retptr=%08x): no entry address", moduleId, argsize, argAddr, returnValueAddr);
module->nm.status = MODULE_STATUS_STARTED;
} else {