mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-16 12:39:57 +00:00
sys_ppu_thread_create: minimum stack size and stack allocation unit applied.
This commit is contained in:
parent
bf1e29e227
commit
73d9b58dfc
@ -162,6 +162,15 @@ PPUThread* ppu_thread_create(u32 entry, u64 arg, s32 prio, u32 stacksize, bool i
|
||||
{
|
||||
PPUThread& new_thread = *(PPUThread*)&Emu.GetCPU().AddThread(CPU_THREAD_PPU);
|
||||
|
||||
// Note: I haven't figured out the minimum stack size of PPU Thread.
|
||||
// Maybe it can be done with pthread_attr_getstacksize function.
|
||||
// And i toke 4096 (PTHREAD_STACK_MIN, and the smallest allocation unit) for this.
|
||||
if ((stacksize % 4096) || (stacksize == 0)) {
|
||||
// If not times of smallest allocation unit, round it up to the nearest one.
|
||||
// And regard zero as a same condition.
|
||||
stacksize = 4096 * ((u32)(stacksize / 4096) + 1);
|
||||
}
|
||||
|
||||
u32 id = new_thread.GetId();
|
||||
new_thread.SetEntry(entry);
|
||||
new_thread.SetPrio(prio);
|
||||
|
Loading…
x
Reference in New Issue
Block a user