@@ -1054,4 +1054,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
@@ -1720,6 +1720,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 */
@@ -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"
@@ -1565,6 +1564,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.