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

Minor optimization

This commit is contained in:
Nekotekina 2017-03-13 13:35:20 +03:00
parent 78703cfe47
commit 1ede0f4706
4 changed files with 25 additions and 2 deletions

View File

@ -1003,9 +1003,17 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
{
g_tls_fault_all++;
const auto cpu = get_current_cpu_thread();
if (rsx::g_access_violation_handler && rsx::g_access_violation_handler(addr, is_writing))
{
g_tls_fault_rsx++;
if (cpu)
{
cpu->test_state();
}
return true;
}
@ -1142,11 +1150,16 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
if (vm::check_addr(addr, d_size))
{
if (cpu)
{
cpu->test_state();
}
return true;
}
// TODO: allow recovering from a page fault as a feature of PS3 virtual memory
if (const auto cpu = get_current_cpu_thread())
if (cpu)
{
LOG_FATAL(MEMORY, "Access violation %s location 0x%x", is_writing ? "writing" : "reading", addr);
cpu->state += cpu_flag::dbg_pause;

View File

@ -107,6 +107,14 @@ namespace vm
}
}
void temporary_unlock() noexcept
{
if (auto cpu = get_current_cpu_thread())
{
temporary_unlock(*cpu);
}
}
reader_lock::reader_lock()
: locked(true)
{

View File

@ -70,6 +70,7 @@ namespace vm
// Optimization (set cpu_flag::memory)
void temporary_unlock(cpu_thread& cpu) noexcept;
void temporary_unlock() noexcept;
constexpr struct try_to_lock_t{} try_to_lock{};

View File

@ -51,6 +51,7 @@ namespace gl
//LOG_WARNING(RSX, "Cache access not from worker thread! address = 0x%X", address);
work_item &task = m_renderer->post_flush_request(address, section_to_post);
vm::temporary_unlock();
{
std::unique_lock<std::mutex> lock(task.guard_mutex);
task.cv.wait(lock, [&task] { return task.processed; });
@ -62,4 +63,4 @@ namespace gl
return false;
}
}
}