X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=memory_mapping.c;h=6a39d71da269acb950297b434e3e13d7a9c0b8b8;hb=05a6f451eb0e3224a8e6d98089379f20ec06c787;hp=87a6ed5c8e198c2055dcfbdb15adbd2330735e8f;hpb=aaa6a40194e9f204cb853f64ef3c1e170bb014e8;p=mirror_qemu.git diff --git a/memory_mapping.c b/memory_mapping.c index 87a6ed5c8e..6a39d71da2 100644 --- a/memory_mapping.c +++ b/memory_mapping.c @@ -11,10 +11,11 @@ * */ -#include +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qemu-common.h" #include "cpu.h" -#include "exec/cpu-all.h" #include "sysemu/memory_mapping.h" #include "exec/memory.h" #include "exec/address-spaces.h" @@ -177,6 +178,7 @@ void guest_phys_blocks_free(GuestPhysBlockList *list) QTAILQ_FOREACH_SAFE(p, &list->head, next, q) { QTAILQ_REMOVE(&list->head, p, next); + memory_region_unref(p->mr); g_free(p); } list->num = 0; @@ -203,7 +205,8 @@ static void guest_phys_blocks_region_add(MemoryListener *listener, GuestPhysBlock *predecessor; /* we only care about RAM */ - if (!memory_region_is_ram(section->mr)) { + if (!memory_region_is_ram(section->mr) || + memory_region_is_ram_device(section->mr)) { return; } @@ -239,6 +242,8 @@ static void guest_phys_blocks_region_add(MemoryListener *listener, block->target_start = target_start; block->target_end = target_end; block->host_addr = host_addr; + block->mr = section->mr; + memory_region_ref(section->mr); QTAILQ_INSERT_TAIL(&g->list->head, block, next); ++g->list->num;