Received: from eggs.gnu.org ([2001:4830:134:3::10]:36580) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiA1U-0003iv-9Y for qemu-devel@nongnu.org; Thu, 30 May 2013 17:04:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UiA1P-0001hl-MS for qemu-devel@nongnu.org; Thu, 30 May 2013 17:04:36 -0400 Received: from mail-ea0-x22e.google.com ([2a00:1450:4013:c01::22e]:43282) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiA1P-0001hh-H8 for qemu-devel@nongnu.org; Thu, 30 May 2013 17:04:31 -0400 Received: by mail-ea0-f174.google.com with SMTP id z7so842807eaf.33 for ; Thu, 30 May 2013 14:04:30 -0700 (PDT) Received: from playground.lan (net-37-116-217-184.cust.dsl.vodafone.it. [37.116.217.184]) by mx.google.com with ESMTPSA id y2sm62707218eeu.2.2013.05.30.14.04.29 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 30 May 2013 14:04:30 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Thu, 30 May 2013 23:03:48 +0200 Message-Id: <1369947836-2638-15-git-send-email-pbonzini@redhat.com> In-Reply-To: <1369947836-2638-1-git-send-email-pbonzini@redhat.com> References: <1369947836-2638-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 14/22] exec: implement .valid.accepts for subpages List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- exec.c | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/exec.c b/exec.c index d640d07..ab4b4d2 100644 --- a/exec.c +++ b/exec.c @@ -1558,9 +1558,29 @@ static void subpage_write(void *opaque, hwaddr addr, io_mem_write(section->mr, addr, value, len); } +static bool subpage_accepts(void *opaque, hwaddr addr, + unsigned size, bool is_write) +{ + subpage_t *mmio = opaque; + unsigned int idx = SUBPAGE_IDX(addr); + MemoryRegionSection *section; +#if defined(DEBUG_SUBPAGE) + printf("%s: subpage %p %c len %d addr " TARGET_FMT_plx + " idx %d\n", __func__, mmio, + is_write ? 'w' : 'r', len, addr, idx); +#endif + + section = &phys_sections[mmio->sub_section[idx]]; + addr += mmio->base; + addr -= section->offset_within_address_space; + addr += section->offset_within_region; + return memory_region_access_valid(section->mr, addr, size, is_write); +} + static const MemoryRegionOps subpage_ops = { .read = subpage_read, .write = subpage_write, + .valid.accepts = subpage_accepts, .endianness = DEVICE_NATIVE_ENDIAN, }; -- 1.7.4.1