Received: from eggs.gnu.org ([2001:4830:134:3::10]:36431) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiA1C-00039I-06 for qemu-devel@nongnu.org; Thu, 30 May 2013 17:04:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UiA17-0001co-2m for qemu-devel@nongnu.org; Thu, 30 May 2013 17:04:17 -0400 Received: from mail-ea0-x235.google.com ([2a00:1450:4013:c01::235]:36774) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiA16-0001cd-NW for qemu-devel@nongnu.org; Thu, 30 May 2013 17:04:13 -0400 Received: by mail-ea0-f181.google.com with SMTP id a11so850477eae.26 for ; Thu, 30 May 2013 14:04:12 -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.10 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 30 May 2013 14:04:11 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Thu, 30 May 2013 23:03:39 +0200 Message-Id: <1369947836-2638-6-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 05/22] exec: do not use error_mem_read List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org We will soon reach this case when doing (unaligned) accesses that span partly past the end of memory. We do not want to crash in that case. unassigned_mem_ops and rom_mem_ops are now the same. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- exec.c | 16 ++-------------- 1 files changed, 2 insertions(+), 14 deletions(-) diff --git a/exec.c b/exec.c index 7e22980..785eeeb 100644 --- a/exec.c +++ b/exec.c @@ -1412,18 +1412,6 @@ static const MemoryRegionOps unassigned_mem_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; -static uint64_t error_mem_read(void *opaque, hwaddr addr, - unsigned size) -{ - abort(); -} - -static const MemoryRegionOps rom_mem_ops = { - .read = error_mem_read, - .write = unassigned_mem_write, - .endianness = DEVICE_NATIVE_ENDIAN, -}; - static void notdirty_mem_write(void *opaque, hwaddr ram_addr, uint64_t val, unsigned size) { @@ -1455,7 +1443,7 @@ static void notdirty_mem_write(void *opaque, hwaddr ram_addr, } static const MemoryRegionOps notdirty_mem_ops = { - .read = error_mem_read, + .read = unassigned_mem_read, .write = notdirty_mem_write, .endianness = DEVICE_NATIVE_ENDIAN, }; @@ -1676,7 +1664,7 @@ MemoryRegion *iotlb_to_region(hwaddr index) static void io_mem_init(void) { - memory_region_init_io(&io_mem_rom, &rom_mem_ops, NULL, "rom", UINT64_MAX); + memory_region_init_io(&io_mem_rom, &unassigned_mem_ops, NULL, "rom", UINT64_MAX); memory_region_init_io(&io_mem_unassigned, &unassigned_mem_ops, NULL, "unassigned", UINT64_MAX); memory_region_init_io(&io_mem_notdirty, ¬dirty_mem_ops, NULL, -- 1.7.4.1