Processor::ExecuteRaw

Changed the breakpoint lock to a recursive mutex.
This commit is contained in:
Dr. Chat 2015-11-27 22:28:21 -06:00 committed by Ben Vanik
parent ac706f6923
commit 7d59258839
2 changed files with 20 additions and 4 deletions

View File

@ -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<std::mutex> lock(breakpoint_lock_);
std::lock_guard<std::recursive_mutex> 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<std::mutex> lock(breakpoint_lock_);
std::lock_guard<std::recursive_mutex> 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<std::mutex> lock(breakpoint_lock_);
std::lock_guard<std::recursive_mutex> lock(breakpoint_lock_);
for (auto it = breakpoints_.begin(); it != breakpoints_.end(); it++) {
if ((*it)->address() == address) {

View File

@ -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<Breakpoint*> breakpoints_;
Irql irql_;