From 3007a98d2ded53043b43a378c841f225dcd852c4 Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Sun, 6 Dec 2015 18:45:58 -0600 Subject: [PATCH] Install false-branch breakpoint only if the opcode is conditional. --- src/xenia/kernel/xthread.cc | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/xenia/kernel/xthread.cc b/src/xenia/kernel/xthread.cc index 4a78ce651..78d311840 100644 --- a/src/xenia/kernel/xthread.cc +++ b/src/xenia/kernel/xthread.cc @@ -819,10 +819,22 @@ uint32_t XThread::StepIntoBranch(uint32_t pc) { fence.Signal(); }; + bool conditional = true; + if (i.type->opcode = 0x40000000) { + // bx + if (cpu::frontend::select_bits(i.B.BO, 4, 4)) { + conditional = false; + } + } else { + // bctrx/blrx + if (cpu::frontend::select_bits(i.XL.BO, 4, 4)) { + conditional = false; + } + } + cpu::Breakpoint bpt(kernel_state()->processor(), callback); cpu::Breakpoint bpf(kernel_state()->processor(), pc + 4, callback); - if (!bpf.Install()) { - // FIXME: This won't work on non-conditional conditional branches. + if (conditional && !bpf.Install()) { XELOGE("XThread: Could not install breakpoint to step forward!"); assert_always(); } @@ -854,8 +866,10 @@ uint32_t XThread::StepIntoBranch(uint32_t pc) { thread_->Resume(); fence.Wait(); - bpf.Uninstall(); bpt.Uninstall(); + if (conditional) { + bpf.Uninstall(); + } } return pc;