Thread: Default to kernel threads from kernel.

This is an experiment.  In most cases, allowKernel will be false.
This commit is contained in:
Unknown W. Brackets
2020-05-25 18:59:07 +08:00
committed by sum2012
parent 104bf3915e
commit e8b651fbd6
3 changed files with 26 additions and 6 deletions
+13 -1
View File
@@ -66,7 +66,8 @@
#include "GPU/GPUState.h"
enum {
PSP_THREAD_ATTR_USER = 0x80000000
PSP_THREAD_ATTR_KERNEL = 0x00001000,
PSP_THREAD_ATTR_USER = 0x80000000,
};
enum {
@@ -1593,6 +1594,7 @@ static void __KernelStartModule(PSPModule *m, int args, const char *argp, SceKer
currentMIPS->pc = m->nm.module_start_func;
}
WARN_LOG(SCEKERNEL, "Root thread attr: %08x", options->attribute);
SceUID threadID = __KernelSetupRootThread(m->GetUID(), args, argp, options->priority, options->stacksize, options->attribute);
__KernelSetThreadRA(threadID, NID_MODULERETURN);
}
@@ -1608,6 +1610,16 @@ u32 __KernelGetModuleGP(SceUID uid) {
}
}
bool KernelModuleIsKernelMode(SceUID uid) {
u32 error;
PSPModule *module = kernelObjects.Get<PSPModule>(uid, error);
if (module) {
return (module->nm.attribute & 0x1000) != 0;
} else {
return false;
}
}
void __KernelLoadReset() {
// Wipe kernel here, loadexec should reset the entire system
if (__KernelIsRunning()) {