diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2014-05-14 17:43:18 +0800 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2014-06-19 18:44:19 +0300 |
commit | e1c57ab86f3c4ea6532b51cfecf32770b45f5e7a (patch) | |
tree | efabd38dd43f634554d6349998f94f0f92c61289 /memory.c | |
parent | dfabb8b91655f680eaa1aa05e9f226fbd596a70f (diff) | |
download | hqemu-e1c57ab86f3c4ea6532b51cfecf32770b45f5e7a.zip hqemu-e1c57ab86f3c4ea6532b51cfecf32770b45f5e7a.tar.gz |
memory: reorganize file-based allocation
Split the internal interface in exec.c to a separate function, and
push the check on mem_path up to memory_region_init_ram.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'memory.c')
-rw-r--r-- | memory.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -23,6 +23,7 @@ #include "exec/memory-internal.h" #include "exec/ram_addr.h" +#include "sysemu/sysemu.h" //#define DEBUG_UNASSIGNED @@ -1029,7 +1030,11 @@ void memory_region_init_ram(MemoryRegion *mr, mr->ram = true; mr->terminates = true; mr->destructor = memory_region_destructor_ram; - mr->ram_addr = qemu_ram_alloc(size, mr); + if (mem_path) { + mr->ram_addr = qemu_ram_alloc_from_file(size, mr, mem_path); + } else { + mr->ram_addr = qemu_ram_alloc(size, mr); + } } void memory_region_init_ram_ptr(MemoryRegion *mr, |