From: "Edgar E. Iglesias" <edgar.igles...@xilinx.com> Signed-off-by: Edgar E. Iglesias <edgar.igles...@xilinx.com> --- include/exec/memory.h | 8 ++++++++ memory.c | 12 ++++++++++++ 2 files changed, 20 insertions(+)
diff --git a/include/exec/memory.h b/include/exec/memory.h index 2d0b614..02f4012 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -941,6 +941,14 @@ void mtree_info(fprintf_function mon_printf, void *f); */ void address_space_init(AddressSpace *as, MemoryRegion *root, const char *name); +/** + * 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); /** * address_space_destroy: destroy an address space 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 */ -- 1.7.10.4