qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH v3 18/22] memory: Add address_space_find_by_name()


From: edgar . iglesias
Subject: [Qemu-devel] [PATCH v3 18/22] memory: Add address_space_find_by_name()
Date: Mon, 13 Jan 2014 17:39:58 +1000

From: "Edgar E. Iglesias" <address@hidden>

Signed-off-by: Edgar E. Iglesias <address@hidden>
---
 include/exec/memory.h |    9 +++++++++
 memory.c              |   12 ++++++++++++
 translate-all.c       |   10 ++++++++--
 3 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/include/exec/memory.h b/include/exec/memory.h
index 2d0b614..a673567 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -1056,4 +1056,13 @@ void address_space_unmap(AddressSpace *as, void *buffer, 
hwaddr len,
 
 #endif
 
+/**
+ * address_space_find_by_name: Find an AddressSpace * by name
+ *
+ * Returns an AddressSpace * if found.
+ *
+ * @name: name of an address space too look for.
+ */
+AddressSpace *address_space_find_by_name(const char *name);
+
 #endif
diff --git a/memory.c b/memory.c
index 7764314..4695879 100644
--- a/memory.c
+++ b/memory.c
@@ -1725,6 +1725,18 @@ void address_space_init(AddressSpace *as, MemoryRegion 
*root, const char *name)
     memory_region_transaction_commit();
 }
 
+AddressSpace *address_space_find_by_name(const char *name)
+{
+    AddressSpace *as;
+
+    QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) {
+        if (strcmp(as->name, name) == 0) {
+            return as;
+        }
+    }
+    return NULL;
+}
+
 void address_space_destroy(AddressSpace *as)
 {
     /* Flush out anything from MemoryListeners listening in on this */
diff --git a/translate-all.c b/translate-all.c
index 3cbe0d4..ce55106 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -52,9 +52,8 @@
 #include <libutil.h>
 #endif
 #endif
-#else
-#include "exec/address-spaces.h"
 #endif
+#include "exec/address-spaces.h"
 
 #include "exec/cputlb.h"
 #include "translate-all.h"
@@ -1563,6 +1562,13 @@ void cpu_interrupt(CPUState *cpu, int mask)
     cpu->tcg_exit_req = 1;
 }
 
+/* Find an address space by name in user emulation.  */
+AddressSpace *address_space_find_by_name(const char *name)
+{
+    /* Unsupported.  */
+    return NULL;
+}
+
 /*
  * Walks guest process memory "regions" one by one
  * and calls callback function 'fn' for each region.
-- 
1.7.10.4




reply via email to

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