mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-30 17:53:42 +01:00
Hackery to free up RAM (sceKernelMaxFreeMemSize lies a bit more, kill root stack)
This commit is contained in:
1 parent
040b6199b7
commit
b24511ac41
3 files changed
+25
-8
No files matched your search
@@ -67,7 +67,7 @@ const char *waitTypeStrings[] =
|
||||
"Vpl",
|
||||
"Fpl",
|
||||
"",
|
||||
"ThreadEnd",
|
||||
"ThreadEnd", // These are nonstandard wait types
|
||||
"AudioChannel",
|
||||
"Umd",
|
||||
"Vblank",
|
||||
@@ -212,13 +212,21 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
void FreeStack() {
|
||||
if (stackBlock != 0) {
|
||||
DEBUG_LOG(HLE, "Freeing thread stack %s", nt.name);
|
||||
if (nt.attr & PSP_THREAD_ATTR_KERNEL) {
|
||||
kernelMemory.Free(stackBlock);
|
||||
} else {
|
||||
userMemory.Free(stackBlock);
|
||||
}
|
||||
stackBlock = 0;
|
||||
}
|
||||
}
|
||||
|
||||
~Thread()
|
||||
{
|
||||
if (nt.attr & PSP_THREAD_ATTR_KERNEL) {
|
||||
kernelMemory.Free(stackBlock);
|
||||
} else {
|
||||
userMemory.Free(stackBlock);
|
||||
}
|
||||
FreeStack();
|
||||
}
|
||||
|
||||
// Utils
|
||||
@@ -899,6 +907,11 @@ void sceKernelGetThreadStackFreeSize()
|
||||
void __KernelReturnFromThread()
|
||||
{
|
||||
INFO_LOG(HLE,"__KernelReturnFromThread : %s", currentThread->GetName());
|
||||
// TEMPORARY HACK: kill the stack of the root thread early:
|
||||
if (!strcmp(currentThread->GetName(), "root")) {
|
||||
currentThread->FreeStack();
|
||||
}
|
||||
|
||||
currentThread->nt.exitStatus = currentThread->context.r[2];
|
||||
currentThread->nt.status = THREADSTATUS_DORMANT;
|
||||
|
||||
|
||||
Reference in new issue
Block a user