summaryrefslogtreecommitdiffstats
path: root/src/core/arm/arm_interface.cpp
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2022-06-06 18:56:01 +0200
committerLiam <byteslice@airmail.cc>2022-06-16 19:18:07 +0200
commit208ed712f42cfd277405a22663197dc1c5e84cfe (patch)
tree56c1a3cbddf392d700e817cd4093564e3f096013 /src/core/arm/arm_interface.cpp
parentMerge pull request #8457 from liamwhite/kprocess-suspend (diff)
downloadyuzu-208ed712f42cfd277405a22663197dc1c5e84cfe.tar
yuzu-208ed712f42cfd277405a22663197dc1c5e84cfe.tar.gz
yuzu-208ed712f42cfd277405a22663197dc1c5e84cfe.tar.bz2
yuzu-208ed712f42cfd277405a22663197dc1c5e84cfe.tar.lz
yuzu-208ed712f42cfd277405a22663197dc1c5e84cfe.tar.xz
yuzu-208ed712f42cfd277405a22663197dc1c5e84cfe.tar.zst
yuzu-208ed712f42cfd277405a22663197dc1c5e84cfe.zip
Diffstat (limited to 'src/core/arm/arm_interface.cpp')
-rw-r--r--src/core/arm/arm_interface.cpp41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/core/arm/arm_interface.cpp b/src/core/arm/arm_interface.cpp
index 9a285dfc6..6425e131f 100644
--- a/src/core/arm/arm_interface.cpp
+++ b/src/core/arm/arm_interface.cpp
@@ -121,8 +121,15 @@ void ARM_Interface::Run() {
// Notify the debugger and go to sleep if a breakpoint was hit.
if (Has(hr, breakpoint)) {
+ RewindBreakpointInstruction();
system.GetDebugger().NotifyThreadStopped(current_thread);
- current_thread->RequestSuspend(Kernel::SuspendType::Debug);
+ current_thread->RequestSuspend(SuspendType::Debug);
+ break;
+ }
+ if (Has(hr, watchpoint)) {
+ RewindBreakpointInstruction();
+ system.GetDebugger().NotifyThreadWatchpoint(current_thread, *HaltedWatchpoint());
+ current_thread->RequestSuspend(SuspendType::Debug);
break;
}
@@ -136,4 +143,36 @@ void ARM_Interface::Run() {
}
}
+void ARM_Interface::LoadWatchpointArray(const WatchpointArray& wp) {
+ watchpoints = &wp;
+}
+
+const Kernel::DebugWatchpoint* ARM_Interface::MatchingWatchpoint(
+ VAddr addr, u64 size, Kernel::DebugWatchpointType access_type) const {
+ if (!watchpoints) {
+ return nullptr;
+ }
+
+ const VAddr start_address{addr};
+ const VAddr end_address{addr + size};
+
+ for (size_t i = 0; i < Core::Hardware::NUM_WATCHPOINTS; i++) {
+ const auto& watch{(*watchpoints)[i]};
+
+ if (end_address <= watch.start_address) {
+ continue;
+ }
+ if (start_address >= watch.end_address) {
+ continue;
+ }
+ if ((access_type & watch.type) == Kernel::DebugWatchpointType::None) {
+ continue;
+ }
+
+ return &watch;
+ }
+
+ return nullptr;
+}
+
} // namespace Core