Received: from eggs.gnu.org ([140.186.70.92]:52216) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjWWp-0001cS-Hd for qemu-devel@nongnu.org; Sat, 07 Jan 2012 08:41:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RjWWo-0007DC-8D for qemu-devel@nongnu.org; Sat, 07 Jan 2012 08:41:47 -0500 Received: from v220110690675601.yourvserver.net ([78.47.199.172]:34710) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjWWo-0007D8-2F for qemu-devel@nongnu.org; Sat, 07 Jan 2012 08:41:46 -0500 From: Stefan Weil Date: Sat, 7 Jan 2012 12:13:46 +0100 Message-Id: <1325934826-23870-1-git-send-email-sw@weilnetz.de> Subject: [Qemu-devel] [PATCH] memory: Fix assertion for flash devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Stefan Weil , Avi Kivity There is a regression since commit c5705a7728b4a6bc9e4f2d35911adbaf28042b25 or some other recent change. System emulation with a flash device raises an assertion in function qemu_ram_set_idstr because no new_block is found at the requested addr. The address of the memory region (mr->ram_addr) is set by memory_region_init_rom_device: mr->ram_addr = qemu_ram_alloc(size, mr); mr->ram_addr |= cpu_register_io_memory(mr); The 2nd line adds a small offset to mr->ram_addr, and this offset makes ram_set_idstr fail with an assertion. Masking mr->ram_addr with the target's page mask removes the small offset and makes flash devices work again. Cc: Avi Kivity Signed-off-by: Stefan Weil --- memory.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/memory.c b/memory.c index 394cbab..1b2f9e8 100644 --- a/memory.c +++ b/memory.c @@ -1386,7 +1386,7 @@ void memory_region_set_alias_offset(MemoryRegion *mr, target_phys_addr_t offset) ram_addr_t memory_region_get_ram_addr(MemoryRegion *mr) { - return mr->ram_addr; + return mr->ram_addr & TARGET_PAGE_MASK; } static int cmp_flatrange_addr(const void *addr_, const void *fr_) -- 1.7.0.4