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>
This commit is contained in:
parent
39fa93c443
commit
83696c8f78
13
memory.c
13
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,
|
||||
|
Loading…
Reference in New Issue
Block a user