qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] memory: Fix assertion for flash devices


From: Avi Kivity
Subject: Re: [Qemu-devel] [PATCH] memory: Fix assertion for flash devices
Date: Sun, 08 Jan 2012 13:07:16 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0

On 01/07/2012 01:13 PM, Stefan Weil wrote:
> 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.
>
>
> 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;
>  }
>  

This makes get_ram_addr() lie about the return value - it's no longer
the ram_addr.  Doesn't matter much since it's temporary, but I patched
vmstate_register_ram() instead.

-- 
error compiling committee.c: too many arguments to function




reply via email to

[Prev in Thread] Current Thread [Next in Thread]