From 7d592588399bdec1a203296bc29b45b72a3a4c77 Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Fri, 27 Nov 2015 22:28:21 -0600 Subject: [PATCH] Processor::ExecuteRaw Changed the breakpoint lock to a recursive mutex. --- src/xenia/cpu/processor.cc | 21 ++++++++++++++++++--- src/xenia/cpu/processor.h | 3 ++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/xenia/cpu/processor.cc b/src/xenia/cpu/processor.cc index 7b1b36a92..830b8c1e3 100644 --- a/src/xenia/cpu/processor.cc +++ b/src/xenia/cpu/processor.cc @@ -314,6 +314,21 @@ bool Processor::Execute(ThreadState* thread_state, uint32_t address) { return result; } +bool Processor::ExecuteRaw(ThreadState* thread_state, uint32_t address) { + SCOPE_profile_cpu_f("cpu"); + + // Attempt to get the function. + auto function = ResolveFunction(address); + if (!function) { + // Symbol not found in any module. + XELOGCPU("Execute(%.8X): failed to find function", address); + return false; + } + + auto context = thread_state->context(); + return function->Call(thread_state, uint32_t(context->lr)); +} + uint64_t Processor::Execute(ThreadState* thread_state, uint32_t address, uint64_t args[], size_t arg_count) { SCOPE_profile_cpu_f("cpu"); @@ -385,7 +400,7 @@ void Processor::LowerIrql(Irql old_value) { } bool Processor::InstallBreakpoint(Breakpoint* bp) { - std::lock_guard lock(breakpoint_lock_); + std::lock_guard lock(breakpoint_lock_); if (FindBreakpoint(bp->address())) { return false; @@ -403,7 +418,7 @@ bool Processor::InstallBreakpoint(Breakpoint* bp) { } bool Processor::UninstallBreakpoint(Breakpoint* bp) { - std::lock_guard lock(breakpoint_lock_); + std::lock_guard lock(breakpoint_lock_); if (!backend_->UninstallBreakpoint(bp)) { return false; @@ -434,7 +449,7 @@ bool Processor::BreakpointHit(uint32_t address, uint64_t host_pc) { } Breakpoint* Processor::FindBreakpoint(uint32_t address) { - std::lock_guard lock(breakpoint_lock_); + std::lock_guard lock(breakpoint_lock_); for (auto it = breakpoints_.begin(); it != breakpoints_.end(); it++) { if ((*it)->address() == address) { diff --git a/src/xenia/cpu/processor.h b/src/xenia/cpu/processor.h index 427fd5ac0..1963f7447 100644 --- a/src/xenia/cpu/processor.h +++ b/src/xenia/cpu/processor.h @@ -84,6 +84,7 @@ class Processor { Function* ResolveFunction(uint32_t address); bool Execute(ThreadState* thread_state, uint32_t address); + bool ExecuteRaw(ThreadState* thread_state, uint32_t address); uint64_t Execute(ThreadState* thread_state, uint32_t address, uint64_t args[], size_t arg_count); uint64_t ExecuteInterrupt(ThreadState* thread_state, uint32_t address, @@ -120,7 +121,7 @@ class Processor { Module* builtin_module_ = nullptr; uint32_t next_builtin_address_ = 0xFFFF0000u; - std::mutex breakpoint_lock_; + std::recursive_mutex breakpoint_lock_; std::vector breakpoints_; Irql irql_;