Skip to content

Commit

Permalink
SPU MFC: Implement MFC commands execution shuffling
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 committed Jun 27, 2020
1 parent 9cb4402 commit a43c506
Show file tree
Hide file tree
Showing 7 changed files with 195 additions and 77 deletions.
5 changes: 5 additions & 0 deletions rpcs3/Emu/CPU/CPUThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,11 @@ cpu_thread::cpu_thread(u32 id)

bool cpu_thread::check_state() noexcept
{
if (state & cpu_flag::pending && cpu_work())
{
state -= cpu_flag::pending;
}

if (state & cpu_flag::dbg_pause)
{
g_fxo->get<gdb_server>()->pause_from(this);
Expand Down
4 changes: 4 additions & 0 deletions rpcs3/Emu/CPU/CPUThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ enum class cpu_flag : u32
ret, // Callback return requested
signal, // Thread received a signal (HLE)
memory, // Thread must unlock memory mutex
pending, // Thread has postponed work

dbg_global_pause, // Emulation paused
dbg_global_stop, // Emulation stopped
Expand Down Expand Up @@ -117,6 +118,9 @@ class cpu_thread
// Callback for cpu_flag::memory
virtual void cpu_mem() {}

// Callback for cpu_flag::pending
virtual bool cpu_work() { return true; }

// Callback for vm::temporary_unlock
virtual void cpu_unmem() {}

Expand Down
5 changes: 5 additions & 0 deletions rpcs3/Emu/Cell/SPUASMJITRecompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2596,6 +2596,11 @@ void spu_recompiler::WRCH(spu_opcode_t op)
}

_spu->do_mfc(true);

if (_spu->check_mfc_interrupts(_spu->pc + 4))
{
spu_runtime::g_escape(_spu);
}
};

Label ret = c->newLabel();
Expand Down
5 changes: 4 additions & 1 deletion rpcs3/Emu/Cell/SPUInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ void spu_interpreter::set_interrupt_status(spu_thread& spu, spu_opcode_t op)
spu.set_interrupt_status(false);
}

spu.check_mfc_interrupts(spu.pc);
if (spu.check_mfc_interrupts(spu.pc) && spu.state & cpu_flag::pending)
{
spu.do_mfc();
}
}


Expand Down

0 comments on commit a43c506

Please sign in to comment.