From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40108) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiADv-00052d-02 for qemu-devel@nongnu.org; Thu, 30 May 2013 17:17:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UiADq-0006HC-3w for qemu-devel@nongnu.org; Thu, 30 May 2013 17:17:26 -0400 Received: from mail-ea0-x236.google.com ([2a00:1450:4013:c01::236]:35358) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiADp-0006Gx-UJ for qemu-devel@nongnu.org; Thu, 30 May 2013 17:17:22 -0400 Received: by mail-ea0-f182.google.com with SMTP id r16so855739ead.13 for ; Thu, 30 May 2013 14:17:21 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Thu, 30 May 2013 23:16:49 +0200 Message-Id: <1369948629-2833-2-git-send-email-pbonzini@redhat.com> In-Reply-To: <1369948629-2833-1-git-send-email-pbonzini@redhat.com> References: <1369948629-2833-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 01/21] memory: Introduce address_space_lookup_region List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Jan Kiszka From: Jan Kiszka This introduces a wrapper for phys_page_find (before we complicate address_space_translate with IOMMU translation). The function will also include subpage handling. Signed-off-by: Jan Kiszka Signed-off-by: Paolo Bonzini --- exec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/exec.c b/exec.c index 5b8b40d..2cd4eb3 100644 --- a/exec.c +++ b/exec.c @@ -203,6 +203,12 @@ bool memory_region_is_unassigned(MemoryRegion *mr) && mr != &io_mem_watch; } +static MemoryRegionSection *address_space_lookup_region(AddressSpace *as, + hwaddr addr) +{ + return phys_page_find(as->dispatch, addr >> TARGET_PAGE_BITS); +} + MemoryRegionSection *address_space_translate(AddressSpace *as, hwaddr addr, hwaddr *xlat, hwaddr *plen, bool is_write) @@ -210,7 +216,7 @@ MemoryRegionSection *address_space_translate(AddressSpace *as, hwaddr addr, MemoryRegionSection *section; Int128 diff; - section = phys_page_find(as->dispatch, addr >> TARGET_PAGE_BITS); + section = address_space_lookup_region(as, addr); /* Compute offset within MemoryRegionSection */ addr -= section->offset_within_address_space; -- 1.8.1.4