sys_ppu_thread_create: Add warning when allocated more stack size than required.

This commit is contained in:
luxsie 2015-02-19 01:44:07 +08:00
parent 73d9b58dfc
commit ffb0454424

View File

@ -162,12 +162,14 @@ 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.
// Note: (Syphurith) 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.
sys_ppu_thread.Warning("sys_ppu_thread_create: stacksize increased from 0x%x to 0x%x.",
stacksize, 4096 * ((u32)(stacksize / 4096) + 1));
stacksize = 4096 * ((u32)(stacksize / 4096) + 1);
}