From patchwork Mon Jan 13 07:39:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 309738 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2DAAD2C0079 for ; Mon, 13 Jan 2014 18:53:53 +1100 (EST) Received: from localhost ([::1]:41029 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2cLH-0004kz-4p for incoming@patchwork.ozlabs.org; Mon, 13 Jan 2014 02:53:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2cIz-0001jv-Tp for qemu-devel@nongnu.org; Mon, 13 Jan 2014 02:51:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W2cIn-0007Uc-0i for qemu-devel@nongnu.org; Mon, 13 Jan 2014 02:51:29 -0500 Received: from mail-qe0-x22b.google.com ([2607:f8b0:400d:c02::22b]:52293) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2cIm-0007Tp-SC for qemu-devel@nongnu.org; Mon, 13 Jan 2014 02:51:16 -0500 Received: by mail-qe0-f43.google.com with SMTP id jy17so6877939qeb.30 for ; Sun, 12 Jan 2014 23:51:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lX4BX04cwlUOxMNg4GuZXnTZX4ZNCZN5WKP3xCMCZX8=; b=Z4+DeioCGs0Bucs1y/JIVMcPW8oIg6z0rvJ3PT9Bnt5JwyKAJ2T8etP4lXDvzfLpaC 1KZ6jH8lLhZVGGpl1amJDu+2yrJTqMS+qf5/+6I/IkcqN+K3hxDcw2U/UVmTuM7QkEjc c0g6tB2eRqZAKJ/2Z3ukaCIF9Jn6Qv28lnwZnuBTNijBzMcThnBvX1x+oGkTeyLBmYS0 cb+NPlWP0TLxw2wUQoL2cJZ5pGwxyOA3qmkVj42ekr/9G+kaCuGIGULBl8XcRJLFPrUv y2g6QumRmnbJH1e0SsYm7q3OvhhLLyERys+6jsEaFgotvv3jAh5AiyaYzIoTEoCpxbBF Oprw== X-Received: by 10.224.136.136 with SMTP id r8mr36907434qat.0.1389599476407; Sun, 12 Jan 2014 23:51:16 -0800 (PST) Received: from localhost ([149.199.62.254]) by mx.google.com with ESMTPSA id d7sm24318202qam.5.2014.01.12.23.51.14 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 12 Jan 2014 23:51:15 -0800 (PST) From: edgar.iglesias@gmail.com To: qemu-devel@nongnu.org Date: Mon, 13 Jan 2014 17:39:58 +1000 Message-Id: <1389598802-14977-19-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1389598802-14977-1-git-send-email-edgar.iglesias@gmail.com> References: <1389598802-14977-1-git-send-email-edgar.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c02::22b 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 Subject: [Qemu-devel] [PATCH v3 18/22] memory: Add address_space_find_by_name() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 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 #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.