mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Hackery to free up RAM (sceKernelMaxFreeMemSize lies a bit more, kill root stack)
This commit is contained in:
parent
040b6199b7
commit
b24511ac41
@ -366,7 +366,7 @@ public:
|
||||
void sceKernelMaxFreeMemSize()
|
||||
{
|
||||
// TODO: Fudge factor improvement
|
||||
u32 retVal = userMemory.GetLargestFreeBlockSize()-0x8000;
|
||||
u32 retVal = userMemory.GetLargestFreeBlockSize()-0x40000;
|
||||
DEBUG_LOG(HLE,"%08x (dec %i)=sceKernelMaxFreeMemSize",retVal,retVal);
|
||||
RETURN(retVal);
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -821,10 +821,14 @@ namespace MIPSInt
|
||||
|
||||
void Int_Interrupt(u32 op)
|
||||
{
|
||||
static int reported = 0;
|
||||
switch (op & 1)
|
||||
{
|
||||
case 0:
|
||||
DEBUG_LOG(CPU,"Disable/Enable Interrupt CPU instruction");
|
||||
if (!reported) {
|
||||
WARN_LOG(CPU,"Disable/Enable Interrupt CPU instruction");
|
||||
reported = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
PC += 4;
|
||||
|
Loading…
Reference in New Issue
Block a user