mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-28 13:28:01 +03:00
Fix Emulator::IsPaused() to allow measurements during module compilation
Also fix a potential deadlock in access violation handler for non-cpu_thread
This commit is contained in:
parent
4c0832e6e6
commit
9677a3a9ea
8 changed files with 53 additions and 17 deletions
|
@ -1703,23 +1703,58 @@ bool handle_access_violation(u32 addr, bool is_writing, ucontext_t* context) noe
|
|||
cpu->state += cpu_flag::wait;
|
||||
}
|
||||
|
||||
Emu.Pause(true);
|
||||
|
||||
if (!g_tls_access_violation_recovered)
|
||||
{
|
||||
vm_log.notice("\n%s", dump_useful_thread_info());
|
||||
}
|
||||
|
||||
// Note: a thread may access violate more than once after hack_alloc recovery
|
||||
// Do not log any further access violations in this case.
|
||||
if (!g_tls_access_violation_recovered)
|
||||
{
|
||||
vm_log.notice("\n%s", dump_useful_thread_info());
|
||||
vm_log.fatal("Access violation %s location 0x%x (%s)", is_writing ? "writing" : (cpu && cpu->get_class() == thread_class::ppu && cpu->get_pc() == addr ? "executing" : "reading"), addr, (is_writing && vm::check_addr(addr)) ? "read-only memory" : "unmapped memory");
|
||||
}
|
||||
|
||||
while (Emu.IsPausedOrReady())
|
||||
{
|
||||
if (cpu)
|
||||
{
|
||||
auto state = +cpu->state;
|
||||
|
||||
if (::is_paused(state) && !::is_stopped(state))
|
||||
{
|
||||
thread_ctrl::wait_on(cpu->state, state);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Temporary until Emulator updates state
|
||||
std::this_thread::yield();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
thread_ctrl::wait_for(1000);
|
||||
}
|
||||
}
|
||||
|
||||
Emu.Pause(true);
|
||||
|
||||
while (Emu.IsPaused())
|
||||
{
|
||||
thread_ctrl::wait();
|
||||
if (cpu)
|
||||
{
|
||||
auto state = +cpu->state;
|
||||
|
||||
if (::is_paused(state) && !::is_stopped(state))
|
||||
{
|
||||
thread_ctrl::wait_on(cpu->state, state);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Temporary until Emulator updates state
|
||||
std::this_thread::yield();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
thread_ctrl::wait_for(1000);
|
||||
}
|
||||
}
|
||||
|
||||
if (Emu.IsStopped() && !hack_alloc())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue