1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

vm: Attempt to not remove cpu_flag::wait flag during access violation

This commit is contained in:
Eladash 2022-08-19 12:02:45 +03:00 committed by Ivan
parent b0e2c959eb
commit ddba30988b
4 changed files with 10 additions and 5 deletions

View File

@ -1242,14 +1242,16 @@ bool handle_access_violation(u32 addr, bool is_writing, ucontext_t* context) noe
if (rsx::g_access_violation_handler) if (rsx::g_access_violation_handler)
{ {
bool state_changed = false;
if (cpu) if (cpu)
{ {
vm::temporary_unlock(*cpu); state_changed = vm::temporary_unlock(*cpu);
} }
bool handled = rsx::g_access_violation_handler(addr, is_writing); bool handled = rsx::g_access_violation_handler(addr, is_writing);
if (cpu && (cpu->state += cpu_flag::temp, cpu->test_stopped())) if (state_changed && (cpu->state += cpu_flag::temp, cpu->test_stopped()))
{ {
// //
} }

View File

@ -63,7 +63,7 @@ enum ppu_thread_status : u32;
namespace vm namespace vm
{ {
void temporary_unlock(cpu_thread& cpu) noexcept; bool temporary_unlock(cpu_thread& cpu) noexcept;
} }
namespace cpu_counter namespace cpu_counter

View File

@ -380,7 +380,7 @@ namespace vm
} }
} }
void temporary_unlock(cpu_thread& cpu) noexcept bool temporary_unlock(cpu_thread& cpu) noexcept
{ {
bs_t<cpu_flag> add_state = cpu_flag::wait; bs_t<cpu_flag> add_state = cpu_flag::wait;
@ -392,7 +392,10 @@ namespace vm
if (add_state - cpu.state) if (add_state - cpu.state)
{ {
cpu.state += add_state; cpu.state += add_state;
return true;
} }
return false;
} }
void temporary_unlock() noexcept void temporary_unlock() noexcept

View File

@ -105,7 +105,7 @@ namespace vm
void passive_unlock(cpu_thread& cpu); void passive_unlock(cpu_thread& cpu);
// Optimization (set cpu_flag::memory) // Optimization (set cpu_flag::memory)
void temporary_unlock(cpu_thread& cpu) noexcept; bool temporary_unlock(cpu_thread& cpu) noexcept;
void temporary_unlock() noexcept; void temporary_unlock() noexcept;
struct writer_lock final struct writer_lock final