diff mbox series

[v4,25/28] accel/tcg/cpu-exec: Restrict watchpoint code to system emulation

Message ID 20210303214708.1727801-26-f4bug@amsat.org (mailing list archive)
State New, archived
Headers show
Series cpu: Introduce SysemuCPUOps structure, remove watchpoints from usermode | expand

Commit Message

Philippe Mathieu-Daudé March 3, 2021, 9:47 p.m. UTC
We can not use watchpoints in user-mode emulation because we
need the softmmu slow path to detect accesses to watchpointed
memory. Add #ifdef'ry around it.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 accel/tcg/cpu-exec.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 16e4fe3ccd8..3a6436013ea 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -471,13 +471,16 @@  static inline bool cpu_handle_halt(CPUState *cpu)
 static inline void cpu_handle_debug_exception(CPUState *cpu)
 {
     CPUClass *cc = CPU_GET_CLASS(cpu);
-    CPUWatchpoint *wp;
 
+#ifndef CONFIG_USER_ONLY
     if (!cpu->watchpoint_hit) {
+        CPUWatchpoint *wp;
+
         QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) {
             wp->flags &= ~BP_WATCHPOINT_HIT;
         }
     }
+#endif
 
     if (cc->tcg_ops->debug_excp_handler) {
         cc->tcg_ops->debug_excp_handler(cpu);