Patchwork [05/16] Fix wrong region_offset when overlaying a page with another

login
register
mail settings
Submitter Avi Kivity
Date Jan. 2, 2012, 4:33 p.m.
Message ID <1325522015-503-6-git-send-email-avi@redhat.com>
Download mbox | patch
Permalink /patch/133882/
State New
Headers show

Comments

Avi Kivity - Jan. 2, 2012, 4:33 p.m.
cpu_register_physical_memory_log() does not update region_offset
if a page was previously registered for the same address.  This
could cause mmio accesses going to the wrong place, by using the
old region_offset.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 exec.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Patch

diff --git a/exec.c b/exec.c
index 8a3f621..c366835 100644
--- a/exec.c
+++ b/exec.c
@@ -2542,6 +2542,7 @@  void cpu_register_physical_memory_log(target_phys_addr_t start_addr,
                 p->region_offset = 0;
             } else {
                 p->phys_offset = phys_offset;
+                p->region_offset = region_offset;
                 if ((phys_offset & ~TARGET_PAGE_MASK) <= IO_MEM_ROM ||
                     (phys_offset & IO_MEM_ROMD))
                     phys_offset += TARGET_PAGE_SIZE;