Offset the root thread's stack by arg size.

Otherwise it'll just overwrite, right?
This commit is contained in:
Unknown W. Brackets 2013-09-10 01:12:51 -07:00
parent ff0eb6eb62
commit 0f7ac377cd

View file

@ -1989,10 +1989,11 @@ SceUID __KernelSetupRootThread(SceUID moduleID, int args, const char *argp, int
strcpy(thread->nt.name, "root");
__KernelLoadContext(&thread->context, (attr & PSP_THREAD_ATTR_VFPU) != 0);
mipsr4k.r[MIPS_REG_A0] = args;
mipsr4k.r[MIPS_REG_SP] -= 256;
u32 location = mipsr4k.r[MIPS_REG_SP];
mipsr4k.r[MIPS_REG_A1] = location;
currentMIPS->r[MIPS_REG_A0] = args;
currentMIPS->r[MIPS_REG_SP] -= 256;
u32 location = currentMIPS->r[MIPS_REG_SP];
currentMIPS->r[MIPS_REG_SP] -= (args + 0xf) & ~0xf;
currentMIPS->r[MIPS_REG_A1] = location;
for (int i = 0; i < args; i++)
Memory::Write_U8(argp[i], location + i);