]> git.proxmox.com Git - mirror_qemu.git/commitdiff
exec: add cpu_synchronize_state to cpu_memory_rw_debug
authorChristian Borntraeger <borntraeger@de.ibm.com>
Tue, 7 Mar 2017 14:19:08 +0000 (15:19 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 14 Mar 2017 12:26:36 +0000 (13:26 +0100)
I sometimes got "Cannot access memory" when using the x command
on the monitor. Turns out that the cpu env did contain stale data
(e.g. wrong control register content for page table origin).
We must synchronize the state of the CPU before walking the page
tables. A similar issues happens for a remote gdb, so lets
do the cpu_synchronize_state in cpu_memory_rw_debug.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <1488896348-13560-1-git-send-email-borntraeger@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
exec.c

diff --git a/exec.c b/exec.c
index 68135a9391c457401d931e5efd0cff577677e265..a22f5a03858a2c2a400d68036dde63b4f81f8b81 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -43,6 +43,7 @@
 #include "exec/ioport.h"
 #include "sysemu/dma.h"
 #include "sysemu/numa.h"
+#include "sysemu/hw_accel.h"
 #include "exec/address-spaces.h"
 #include "sysemu/xen-mapcache.h"
 #include "trace-root.h"
@@ -3309,6 +3310,7 @@ int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
     hwaddr phys_addr;
     target_ulong page;
 
+    cpu_synchronize_state(cpu);
     while (len > 0) {
         int asidx;
         MemTxAttrs attrs;