memory: Fix old_portio vs non-zero offset
authorRichard Henderson <rth@twiddle.net>
Wed, 10 Aug 2011 22:28:19 +0000 (15:28 -0700)
committerAvi Kivity <avi@redhat.com>
Mon, 22 Aug 2011 16:29:04 +0000 (19:29 +0300)
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>
Signed-off-by: Avi Kivity <avi@redhat.com>
memory.c

index 531b57533a0900c53073a9c9c5eca00842a6d940..8e9ac460e8813e63fb2f3622c3704035250cbb45 100644 (file)
--- a/memory.c
+++ b/memory.c
@@ -396,7 +396,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;
     }
@@ -418,7 +418,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;
     }