Skip to contentSkip to conversation

Fix wrong region_offset when overlaying a page with another

PATCH In review Avi Kivity 2 participants 3 messages Jan 1, 2012 – Jan 3, 2012

lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

PATCH 1/1 Fix wrong region_offset when overlaying a page with another

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.

---

Once qemu-test is merged, remind me to post a testlet for this.

 exec.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
exec.c +1 -0
index 8a3f621..c366835 100644
@@ -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;
Signature · 1 line
1.7.7.1
Acked-by on v1 1/1
#1 lore raw

Am 01.01.2012 18:23, schrieb Avi Kivity:

Quoted 6 lines

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.

Line numbers don't match master ;) but applies cleanly and looks good.

Andreas

Quoted 15 lines
 exec.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
exec.c +1 -0
index 8a3f621..c366835 100644
@@ -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;
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
author
#2 lore raw
Quoted 10 lines · Andreas Färber

Am 01.01.2012 18:23, schrieb Avi Kivity:

Quoted 6 lines

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.

Line numbers don't match master ;) but applies cleanly and looks good.

It's part of my MemoryRegion dispatch patchset. It may be applied separately or as part of that patchset, but since it's a bugfix I thought I'd highlight it.

Signature · 1 line
error compiling committee.c: too many arguments to function