aboutsummaryrefslogtreecommitdiff
path: root/memory.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@redhat.com>2020-02-24 10:58:17 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2020-03-17 15:18:46 +0100
commit83696c8f78303d916fd8d126bc28b67f25320acb (patch)
tree318f4ae45c1611189c49796d5baec9a0faff10c2 /memory.c
parent39fa93c4438e7c5efb93d859224d27d04e5c2160 (diff)
downloadqemu-83696c8f78303d916fd8d126bc28b67f25320acb.zip
qemu-83696c8f78303d916fd8d126bc28b67f25320acb.tar.gz
qemu-83696c8f78303d916fd8d126bc28b67f25320acb.tar.bz2
memory: Simplify memory_region_init_rom_nomigrate() to ease review
memory_region_init_rom_nomigrate() has the same content than memory_region_init_ram_shared_nomigrate(), with setting the readonly mode. The code is easier to review as creating a readonly ram/shared/nomigrate region. Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Diffstat (limited to 'memory.c')
-rw-r--r--memory.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/memory.c b/memory.c
index fc99e7f..601b749 100644
--- a/memory.c
+++ b/memory.c
@@ -1660,19 +1660,8 @@ void memory_region_init_rom_nomigrate(MemoryRegion *mr,
uint64_t size,
Error **errp)
{
- Error *err = NULL;
- memory_region_init(mr, owner, name, size);
- mr->ram = true;
+ memory_region_init_ram_shared_nomigrate(mr, owner, name, size, false, errp);
mr->readonly = true;
- mr->terminates = true;
- mr->destructor = memory_region_destructor_ram;
- mr->ram_block = qemu_ram_alloc(size, false, mr, &err);
- mr->dirty_log_mask = tcg_enabled() ? (1 << DIRTY_MEMORY_CODE) : 0;
- if (err) {
- mr->size = int128_zero();
- object_unparent(OBJECT(mr));
- error_propagate(errp, err);
- }
}
void memory_region_init_rom_device_nomigrate(MemoryRegion *mr,