Fix wrong region_offset when overlaying a page with another
authorAvi Kivity <avi@redhat.com>
Sun, 1 Jan 2012 16:24:24 +0000 (18:24 +0200)
committerAvi Kivity <avi@redhat.com>
Wed, 4 Jan 2012 11:34:49 +0000 (13:34 +0200)
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>
Acked-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
exec.c

diff --git a/exec.c b/exec.c
index 8a3f6213a63f92668af4e8ca4d78c072754b2ad4..c36683508098dd6db24e25afc76ac55ae1bed019 100644 (file)
--- 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;