1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 12:12:50 +01:00

SPU: cpu_work() fixup, fix recursion in AV handler

This commit is contained in:
Eladash 2021-09-17 20:18:12 +03:00 committed by Ivan
parent 5870da0b55
commit e10c6cbaf7
3 changed files with 19 additions and 15 deletions

View File

@ -1231,19 +1231,15 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) no
bool handled = rsx::g_access_violation_handler(addr, is_writing); bool handled = rsx::g_access_violation_handler(addr, is_writing);
if (handled) if (cpu && (cpu->state += cpu_flag::temp, cpu->test_stopped()))
{
g_tls_fault_rsx++;
if (cpu && cpu->test_stopped())
{ {
// //
} }
return true; if (handled)
}
if (cpu && cpu->test_stopped())
{ {
g_tls_fault_rsx++;
return true;
} }
} }
@ -1389,11 +1385,6 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) no
if (vm::check_addr(addr, is_writing ? vm::page_writable : vm::page_readable)) if (vm::check_addr(addr, is_writing ? vm::page_writable : vm::page_readable))
{ {
if (cpu && cpu->test_stopped())
{
//
}
return true; return true;
} }

View File

@ -1657,14 +1657,20 @@ void spu_thread::cpu_task()
void spu_thread::cpu_work() void spu_thread::cpu_work()
{ {
if (std::exchange(in_cpu_work, true))
{
return;
}
const auto timeout = +g_cfg.core.mfc_transfers_timeout; const auto timeout = +g_cfg.core.mfc_transfers_timeout;
// If either MFC size exceeds limit or timeout has been reached execute pending MFC commands // If either MFC size exceeds limit or timeout has been reached execute pending MFC commands
if (mfc_size > g_cfg.core.mfc_transfers_shuffling || (timeout && get_system_time() - mfc_last_timestamp >= timeout)) if (mfc_size > g_cfg.core.mfc_transfers_shuffling || (timeout && get_system_time() - mfc_last_timestamp >= timeout))
{ {
do_mfc(false, false); do_mfc(false, false);
check_mfc_interrupts(pc + 4);
} }
in_cpu_work = false;
} }
struct raw_spu_cleanup struct raw_spu_cleanup
@ -3187,6 +3193,11 @@ bool spu_thread::process_mfc_cmd()
// Process MFC commands // Process MFC commands
do_mfc(); do_mfc();
if (mfc_size < 16)
{
break;
}
auto old = state.add_fetch(cpu_flag::wait); auto old = state.add_fetch(cpu_flag::wait);
if (is_stopped(old)) if (is_stopped(old))

View File

@ -778,6 +778,8 @@ public:
u64 mfc_dump_idx = 0; u64 mfc_dump_idx = 0;
static constexpr u32 max_mfc_dump_idx = 2048; static constexpr u32 max_mfc_dump_idx = 2048;
bool in_cpu_work = false;
std::array<v128, 0x4000> stack_mirror; // Return address information std::array<v128, 0x4000> stack_mirror; // Return address information
const char* current_func{}; // Current STOP or RDCH blocking function const char* current_func{}; // Current STOP or RDCH blocking function