From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43617) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAGGC-0007OG-EO for qemu-devel@nongnu.org; Mon, 03 Feb 2014 04:56:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WAGG6-0002Y3-J7 for qemu-devel@nongnu.org; Mon, 03 Feb 2014 04:56:12 -0500 Received: from mail-qc0-x22e.google.com ([2607:f8b0:400d:c01::22e]:50226) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAGG6-0002Xv-A7 for qemu-devel@nongnu.org; Mon, 03 Feb 2014 04:56:06 -0500 Received: by mail-qc0-f174.google.com with SMTP id x13so10707760qcv.33 for ; Mon, 03 Feb 2014 01:56:05 -0800 (PST) From: "Edgar E. Iglesias" Date: Mon, 3 Feb 2014 19:44:46 +1000 Message-Id: <1391420690-23745-19-git-send-email-edgar.iglesias@gmail.com> In-Reply-To: <1391420690-23745-1-git-send-email-edgar.iglesias@gmail.com> References: <1391420690-23745-1-git-send-email-edgar.iglesias@gmail.com> Subject: [Qemu-devel] [PATCH v4 18/22] memory: Add address_space_find_by_name() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, blauwirbel@gmail.com, aliguori@amazon.com, pcrost@xilinx.com, pbonzini@redhat.com, afaerber@suse.de, aurelien@aurel32.net, rth@twiddle.net From: "Edgar E. Iglesias" Signed-off-by: Edgar E. Iglesias --- 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 9101fc3..8465d5b 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -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 diff --git a/memory.c b/memory.c index 59ecc28..22fbe16 100644 --- a/memory.c +++ b/memory.c @@ -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 */ diff --git a/translate-all.c b/translate-all.c index 1ac0246..9950c3b 100644 --- a/translate-all.c +++ b/translate-all.c @@ -52,9 +52,8 @@ #include #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. -- 1.8.1.2