qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/2] vmstate, memory: decouple vmstate from memo


From: Jordan Justen
Subject: Re: [Qemu-devel] [PATCH 2/2] vmstate, memory: decouple vmstate from memory API
Date: Sat, 7 Jan 2012 21:14:03 -0800

On Tue, Dec 20, 2011 at 06:05, Avi Kivity <address@hidden> wrote:
> +void qemu_ram_set_idstr(ram_addr_t addr, const char *name, DeviceState *dev)
>  {
>     RAMBlock *new_block, *block;
>
> -    size = TARGET_PAGE_ALIGN(size);
> -    new_block = g_malloc0(sizeof(*new_block));
> +    new_block = NULL;
> +    QLIST_FOREACH(block, &ram_list.blocks, next) {
> +        if (block->offset == addr) {
> +            new_block = block;
> +            break;
> +        }
> +    }
> +    assert(new_block);
> +    assert(!new_block->idstr[0]);

Avi,

When using pflash_cfi01, I hit the assert(new_block) added above.  It
seemed to be caused by the low bits of addr being 0x7.  This seems to
be come from cpu_register_io_memory in memory_region_init_rom_device.

Would this patch be an appropriate fix for this?

diff --git a/exec.c b/exec.c
index b1d6602..b3ebc91 100644
--- a/exec.c
+++ b/exec.c
@@ -2777,7 +2777,7 @@ void qemu_ram_set_idstr(ram_addr_t addr, const char *name,

     new_block = NULL;
     QLIST_FOREACH(block, &ram_list.blocks, next) {
-        if (block->offset == addr) {
+        if (block->offset == (addr & TARGET_PAGE_MASK)) {
             new_block = block;
             break;
         }

-Jordan



reply via email to

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