From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:56953) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZiiY-0000EV-9q for qemu-devel@nongnu.org; Tue, 07 May 2013 10:18:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UZiiW-0005t7-QJ for qemu-devel@nongnu.org; Tue, 07 May 2013 10:18:10 -0400 Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]:41899) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZiiW-0005sw-Hn for qemu-devel@nongnu.org; Tue, 07 May 2013 10:18:08 -0400 Received: by mail-wi0-f170.google.com with SMTP id hq12so4025456wib.3 for ; Tue, 07 May 2013 07:18:07 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 7 May 2013 16:16:51 +0200 Message-Id: <1367936238-12196-14-git-send-email-pbonzini@redhat.com> In-Reply-To: <1367936238-12196-1-git-send-email-pbonzini@redhat.com> References: <1367936238-12196-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 13/40] memory: Introduce address_space_lookup_region List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aik@ozlabs.ru, jan.kiszka@siemens.com, qemulist@gmail.com, stefanha@redhat.com, david@gibson.dropbear.id.au 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 files changed, 7 insertions(+), 1 deletions(-) diff --git a/exec.c b/exec.c index 9709bc4..6efad6d 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 with MemoryRegionSection */ addr -= section->offset_within_address_space; *plen = MIN(section->size - addr, *plen); -- 1.7.1