Patchwork [16/23] memory: temporarily add memory_region_get_ram_addr()

login
register
mail settings
Submitter Avi Kivity
Date Dec. 19, 2011, 2:13 p.m.
Message ID <1324304024-11220-17-git-send-email-avi@redhat.com>
Download mbox | patch
Permalink /patch/132248/
State New
Headers show

Comments

Avi Kivity - Dec. 19, 2011, 2:13 p.m.
This is a layering violation, but needed while the code contains
naked calls to qemu_get_ram_ptr() and the like.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 memory.c |    6 ++++++
 memory.h |   10 ++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

Patch

diff --git a/memory.c b/memory.c
index 2dcbf80..41a106a 100644
--- a/memory.c
+++ b/memory.c
@@ -1376,6 +1376,12 @@  void memory_region_del_subregion(MemoryRegion *mr,
     memory_region_update_topology();
 }
 
+ram_addr_t memory_region_get_ram_addr(MemoryRegion *mr)
+{
+    assert(mr->backend_registered);
+    return mr->ram_addr;
+}
+
 static int cmp_flatrange_addr(const void *_addr, const void *_fr)
 {
     const AddrRange *addr = _addr;
diff --git a/memory.h b/memory.h
index b7d39ed..1e44d86 100644
--- a/memory.h
+++ b/memory.h
@@ -557,6 +557,16 @@  void memory_region_add_subregion_overlap(MemoryRegion *mr,
                                          target_phys_addr_t offset,
                                          MemoryRegion *subregion,
                                          unsigned priority);
+
+/**
+ * memory_region_get_ram_addr: Get the ram address associated with a memory
+ *                             region
+ *
+ * DO NOT USE THIS FUCNTION.  This is a temporary workaround while the Xen
+ * code is being reworked.
+ */
+ram_addr_t memory_region_get_ram_addr(MemoryRegion *mr);
+
 /**
  * memory_region_del_subregion: Remove a subregion.
  *