mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-02 03:32:17 +00:00
Merge pull request #4209 from unknownbrackets/root-thread
Pass arguments to root threads same way as regular threads
This commit is contained in:
commit
62783639b6
@ -2018,12 +2018,13 @@ SceUID __KernelSetupRootThread(SceUID moduleID, int args, const char *argp, int
|
|||||||
|
|
||||||
__KernelLoadContext(&thread->context, (attr & PSP_THREAD_ATTR_VFPU) != 0);
|
__KernelLoadContext(&thread->context, (attr & PSP_THREAD_ATTR_VFPU) != 0);
|
||||||
currentMIPS->r[MIPS_REG_A0] = args;
|
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_SP] -= (args + 0xf) & ~0xf;
|
||||||
|
u32 location = currentMIPS->r[MIPS_REG_SP];
|
||||||
currentMIPS->r[MIPS_REG_A1] = location;
|
currentMIPS->r[MIPS_REG_A1] = location;
|
||||||
for (int i = 0; i < args; i++)
|
if (argp)
|
||||||
Memory::Write_U8(argp[i], location + i);
|
Memory::Memcpy(location, argp, args);
|
||||||
|
// Let's assume same as starting a new thread, 64 bytes for safety/kernel.
|
||||||
|
currentMIPS->r[MIPS_REG_SP] -= 64;
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user