Fix cellVdec regression to be harmonized with the new interrupts model

This commit is contained in:
Eladash 2022-05-25 14:32:52 +03:00 committed by Ivan
parent 88ee62be26
commit 56f95934f5
2 changed files with 10 additions and 15 deletions

View File

@ -1355,8 +1355,6 @@ ppu_thread::~ppu_thread()
perf_log.notice("Perf stats for instructions: total %u", exec_bytes / 4); perf_log.notice("Perf stats for instructions: total %u", exec_bytes / 4);
} }
void ppu_interrupt_thread_entry(ppu_thread&, ppu_opcode_t, be_t<u32>*, struct ppu_intrp_func*);
ppu_thread::ppu_thread(const ppu_thread_params& param, std::string_view name, u32 prio, int detached) ppu_thread::ppu_thread(const ppu_thread_params& param, std::string_view name, u32 prio, int detached)
: cpu_thread(idm::last_id()) : cpu_thread(idm::last_id())
, prio(prio) , prio(prio)
@ -1377,14 +1375,6 @@ ppu_thread::ppu_thread(const ppu_thread_params& param, std::string_view name, u3
gpr[3] = param.arg0; gpr[3] = param.arg0;
gpr[4] = param.arg1; gpr[4] = param.arg1;
} }
else
{
cmd_list
({
{ ppu_cmd::ptr_call, 0 },
std::bit_cast<u64>(&ppu_interrupt_thread_entry)
});
}
// Trigger the scheduler // Trigger the scheduler
state += cpu_flag::suspend; state += cpu_flag::suspend;

View File

@ -38,9 +38,6 @@ void lv2_int_serv::exec() const
{ ppu_cmd::ptr_call, 0 }, { ppu_cmd::ptr_call, 0 },
std::bit_cast<u64>(&ppu_interrupt_thread_entry) std::bit_cast<u64>(&ppu_interrupt_thread_entry)
}); });
thread->cmd_notify++;
thread->cmd_notify.notify_one();
} }
void ppu_thread_exit(ppu_thread&, ppu_opcode_t, be_t<u32>*, struct ppu_intrp_func*); void ppu_thread_exit(ppu_thread&, ppu_opcode_t, be_t<u32>*, struct ppu_intrp_func*);
@ -136,8 +133,16 @@ error_code _sys_interrupt_thread_establish(ppu_thread& ppu, vm::ptr<u32> ih, u32
result = std::make_shared<lv2_int_serv>(it, arg1, arg2); result = std::make_shared<lv2_int_serv>(it, arg1, arg2);
tag->handler = result; tag->handler = result;
it->cmd_list
({
{ ppu_cmd::ptr_call, 0 },
std::bit_cast<u64>(&ppu_interrupt_thread_entry)
});
it->state -= cpu_flag::stop; it->state -= cpu_flag::stop;
it->state.notify_one(cpu_flag::stop); it->state.notify_one(cpu_flag::stop);
return result; return result;
}); });
@ -240,11 +245,11 @@ void ppu_interrupt_thread_entry(ppu_thread& ppu, ppu_opcode_t, be_t<u32>*, struc
const auto state = +ppu.state; const auto state = +ppu.state;
if (::is_stopped(state)) if (::is_stopped(state) || ppu.cmd_notify.exchange(0))
{ {
return; return;
} }
thread_ctrl::wait_on(ppu.state, state); thread_ctrl::wait_on(ppu.cmd_notify, 0);
} }
} }