Patchwork [10/11] memory: Fix old_portio vs non-zero offset.

login
register
mail settings
Submitter Richard Henderson
Date Aug. 10, 2011, 10:28 p.m.
Message ID <1313015300-23920-11-git-send-email-rth@twiddle.net>
Download mbox | patch
Permalink /patch/109471/
State New
Headers show

Comments

Richard Henderson - Aug. 10, 2011, 10:28 p.m.
The legacy functions that we're wrapping expect that offset
to be included in the register.  Indeed, they generally
expect the absolute address and then mask off the "high" bits.

The FDC is the first converted device with a non-zero offset.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 memory.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/memory.c b/memory.c
index a1f118b..2c82cd3 100644
--- a/memory.c
+++ b/memory.c
@@ -367,7 +367,7 @@  static void memory_region_iorange_read(IORange *iorange,
 
         *data = ((uint64_t)1 << (width * 8)) - 1;
         if (mrp) {
-            *data = mrp->read(mr->opaque, offset - mrp->offset);
+            *data = mrp->read(mr->opaque, offset);
         }
         return;
     }
@@ -391,7 +391,7 @@  static void memory_region_iorange_write(IORange *iorange,
         const MemoryRegionPortio *mrp = find_portio(mr, offset, width, true);
 
         if (mrp) {
-            mrp->write(mr->opaque, offset - mrp->offset, data);
+            mrp->write(mr->opaque, offset, data);
         }
         return;
     }