Merge pull request #13372 from sum2012/kernel_minor

Add a check in sceKernelTerminateThread
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2020-09-02 15:01:20 +02:00
commit 0dcaeb7841
1 file changed
+5 -3
+5 -3
View File
@@ -2149,7 +2149,7 @@ void __KernelReturnFromThread()
}
int sceKernelExitThread(int exitStatus) {
if (!__KernelIsDispatchEnabled() && sceKernelGetCompiledSdkVersion() > 0x0307FFFF)
if (!__KernelIsDispatchEnabled() && sceKernelGetCompiledSdkVersion() >= 0x03080000)
return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_CAN_NOT_WAIT);
PSPThread *thread = __GetCurrentThread();
_dbg_assert_msg_(thread != NULL, "Exited from a NULL thread.");
@@ -2185,7 +2185,7 @@ void _sceKernelExitThread(int exitStatus) {
}
int sceKernelExitDeleteThread(int exitStatus) {
if (!__KernelIsDispatchEnabled() && sceKernelGetCompiledSdkVersion() > 0x0307FFFF)
if (!__KernelIsDispatchEnabled() && sceKernelGetCompiledSdkVersion() >= 0x03080000)
return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_CAN_NOT_WAIT);
PSPThread *thread = __GetCurrentThread();
if (thread)
@@ -2304,7 +2304,7 @@ int sceKernelTerminateDeleteThread(int threadID)
ERROR_LOG(SCEKERNEL, "sceKernelTerminateDeleteThread(%i): cannot terminate current thread", threadID);
return SCE_KERNEL_ERROR_ILLEGAL_THID;
}
if (!__KernelIsDispatchEnabled() && sceKernelGetCompiledSdkVersion() > 0x0307FFFF)
if (!__KernelIsDispatchEnabled() && sceKernelGetCompiledSdkVersion() >= 0x03080000)
return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_CAN_NOT_WAIT);
u32 error;
@@ -2337,6 +2337,8 @@ int sceKernelTerminateThread(SceUID threadID) {
if (__IsInInterrupt() && sceKernelGetCompiledSdkVersion() >= 0x03080000) {
return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_CONTEXT, "in interrupt");
}
if (!__KernelIsDispatchEnabled() && sceKernelGetCompiledSdkVersion() >= 0x03080000)
return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_CAN_NOT_WAIT);
if (threadID == 0 || threadID == currentThread) {
return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_THID, "cannot terminate current thread");
}