Received: from eggs.gnu.org ([208.118.235.92]:45105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UekGr-0004lw-M0 for qemu-devel@nongnu.org; Tue, 21 May 2013 06:58:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UekGq-0005TO-Lr for qemu-devel@nongnu.org; Tue, 21 May 2013 06:58:21 -0400 Received: from mail-ea0-x22e.google.com ([2a00:1450:4013:c01::22e]:58448) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UekGq-0005TE-Fb for qemu-devel@nongnu.org; Tue, 21 May 2013 06:58:20 -0400 Received: by mail-ea0-f174.google.com with SMTP id z7so293574eaf.19 for ; Tue, 21 May 2013 03:58:19 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 21 May 2013 12:57:20 +0200 Message-Id: <1369133851-1894-20-git-send-email-pbonzini@redhat.com> In-Reply-To: <1369133851-1894-1-git-send-email-pbonzini@redhat.com> References: <1369133851-1894-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 19/30] memory: Introduce address_space_lookup_region List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, jan.kiszka@gmail.com, Jan Kiszka , David Gibson From: Jan Kiszka This introduces a wrapper for phys_page_find (before we complicate address_space_translate with IOMMU translation). This function will also encapsulate locking and reference counting when we introduce BQL-free dispatching. 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 4cc5ecb..a29dec5 100644 --- a/exec.c +++ b/exec.c @@ -198,13 +198,19 @@ static MemoryRegionSection *phys_page_find(AddressSpaceDispatch *d, hwaddr index return &phys_sections[lp.ptr]; } +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) { MemoryRegionSection *section; - 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; *plen = MIN(section->size - addr, *plen); -- 1.8.1.4