ppu/sys_interrupt: add stack_reset command to fix sys_interrupt stack overflowing

This commit is contained in:
Jake 2018-03-05 20:36:33 -06:00 committed by Ivan
parent 3a9428a88e
commit 7bbadfd08b
3 changed files with 7 additions and 0 deletions

View file

@ -575,6 +575,11 @@ void ppu_thread::cpu_task()
cmd_pop(), lv2_obj::sleep(*this);
break;
}
case ppu_cmd::reset_stack:
{
cmd_pop(), gpr[1] = ::align(stack_addr + stack_size, 0x200) - 0x200;
break;
}
default:
{
fmt::throw_exception("Unknown ppu_cmd(0x%x)" HERE, (u32)type);

View file

@ -16,6 +16,7 @@ enum class ppu_cmd : u32
hle_call, // Execute function by index (arg)
initialize, // ppu_initialize()
sleep,
reset_stack, // resets stack address
};
// Formatting helper

View file

@ -16,6 +16,7 @@ void lv2_int_serv::exec()
{
thread->cmd_list
({
{ ppu_cmd::reset_stack, 0 },
{ ppu_cmd::set_args, 2 }, arg1, arg2,
{ ppu_cmd::lle_call, 2 },
{ ppu_cmd::sleep, 0 }