Psmf: Use kernel memory for helper thread stack.

Also, thread stacks must be 0x200 or larger.
This commit is contained in:
Unknown W. Brackets 2019-07-28 14:55:21 -07:00
parent 1d528d6f3b
commit dd804660c9
5 changed files with 29 additions and 5 deletions

View file

@ -399,8 +399,9 @@ public:
static int GetStaticIDType() { return SCE_KERNEL_TMID_Thread; }
int GetIDType() const override { return SCE_KERNEL_TMID_Thread; }
bool AllocateStack(u32 &stackSize)
{
bool AllocateStack(u32 &stackSize) {
_assert_msg_(SCEKERNEL, stackSize >= 0x200, "thread stack should be 256 bytes or larger");
FreeStack();
bool fromTop = (nt.attr & PSP_THREAD_ATTR_LOW_STACK) == 0;
@ -1183,6 +1184,14 @@ const char *__KernelGetThreadName(SceUID threadID)
return "ERROR";
}
bool KernelIsThreadDormant(SceUID threadID) {
u32 error;
Thread *t = kernelObjects.Get<Thread>(threadID, error);
if (t)
return (t->nt.status & (THREADSTATUS_DEAD | THREADSTATUS_DORMANT)) != 0;
return 0;
}
u32 __KernelGetWaitValue(SceUID threadID, u32 &error)
{
Thread *t = kernelObjects.Get<Thread>(threadID, error);
@ -2352,6 +2361,13 @@ SceUID __KernelGetCurThread()
return currentThread;
}
int KernelCurThreadPriority() {
Thread *t = __GetCurrentThread();
if (t)
return t->nt.currentPriority;
return 0;
}
SceUID __KernelGetCurThreadModuleId()
{
Thread *t = __GetCurrentThread();