Patchwork [v2,2/8] memory: handle old_portio accesses in MMIO path

login
register
mail settings
Submitter Hervé Poussineau
Date June 8, 2013, 5:44 p.m.
Message ID <1370713446-9460-3-git-send-email-hpoussin@reactos.org>
Download mbox | patch
Permalink /patch/249967/
State New
Headers show

Comments

Hervé Poussineau - June 8, 2013, 5:44 p.m.
This patch is only temporary, and will be removed soon.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 memory.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Patch

diff --git a/memory.c b/memory.c
index 5cb8f4a..f27167c 100644
--- a/memory.c
+++ b/memory.c
@@ -933,6 +933,14 @@  static uint64_t memory_region_dispatch_read1(MemoryRegion *mr,
                                   mr->ops->impl.min_access_size,
                                   mr->ops->impl.max_access_size,
                                   memory_region_read_accessor, mr);
+    } else if (mr->ops->old_portio) {
+        MemoryRegionIORange mrio;
+        MemoryRegionSection mrs = memory_region_find(get_system_io(), addr,
+                                                     size);
+        mrio.mr = mr;
+        mrio.offset = mrs.offset_within_region;
+        memory_region_iorange_read(&mrio.iorange, addr - mrio.offset, size,
+                                   &data);
     } else {
         access_with_adjusted_size(addr, &data, size, 1, 4,
                                   memory_region_oldmmio_read_accessor, mr);
@@ -994,6 +1002,14 @@  static bool memory_region_dispatch_write(MemoryRegion *mr,
                                   mr->ops->impl.min_access_size,
                                   mr->ops->impl.max_access_size,
                                   memory_region_write_accessor, mr);
+    } else if (mr->ops->old_portio) {
+        MemoryRegionIORange mrio;
+        MemoryRegionSection mrs = memory_region_find(get_system_io(), addr,
+                                                     size);
+        mrio.mr = mr;
+        mrio.offset = mrs.offset_within_region;
+        memory_region_iorange_write(&mrio.iorange, addr - mrio.offset, size,
+                                    data);
     } else {
         access_with_adjusted_size(addr, &data, size, 1, 4,
                                   memory_region_oldmmio_write_accessor, mr);