qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] fix offset for MMIO subpage access


From: Vincent Palatin
Subject: [Qemu-devel] [PATCH] fix offset for MMIO subpage access
Date: Wed, 2 Mar 2011 16:23:57 -0500

When using a MMIO subpage not starting on a page boundary, the offset
value given to the access handler is based on the start of the MMU page
not on the subpage base.
As a consequence, if you are mapping the same subpage sized MMIO device
at different addresses, this is somewhat impractical and confusing since
the same register will be called with different "offset" depending on the
base address.

My proposal is to workaround this by recording the offset in region_offset
field.

Signed-off-by: Vincent Palatin <address@hidden>
---
 exec.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/exec.c b/exec.c
index d611100..b59e7c9 100644
--- a/exec.c
+++ b/exec.c
@@ -2626,6 +2626,7 @@ void 
cpu_register_physical_memory_offset(target_phys_addr_t start_addr,
             CHECK_SUBPAGE(addr, start_addr, start_addr2, end_addr, end_addr2,
                           need_subpage);
             if (need_subpage) {
+                region_offset -= (start_addr & ~TARGET_PAGE_MASK);
                 if (!(orig_memory & IO_MEM_SUBPAGE)) {
                     subpage = subpage_init((addr & TARGET_PAGE_MASK),
                                            &p->phys_offset, orig_memory,
@@ -2658,6 +2659,7 @@ void 
cpu_register_physical_memory_offset(target_phys_addr_t start_addr,
                               end_addr2, need_subpage);
 
                 if (need_subpage) {
+                    region_offset -= (start_addr & ~TARGET_PAGE_MASK);
                     subpage = subpage_init((addr & TARGET_PAGE_MASK),
                                            &p->phys_offset, IO_MEM_UNASSIGNED,
                                            addr & TARGET_PAGE_MASK);
-- 
1.7.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]