aboutsummaryrefslogtreecommitdiff
path: root/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'memory.c')
-rw-r--r--memory.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/memory.c b/memory.c
index 063effec6b..09f98fcbe6 100644
--- a/memory.c
+++ b/memory.c
@@ -1030,13 +1030,24 @@ void memory_region_init_ram(MemoryRegion *mr,
mr->ram = true;
mr->terminates = true;
mr->destructor = memory_region_destructor_ram;
- if (mem_path) {
- mr->ram_addr = qemu_ram_alloc_from_file(size, mr, mem_path);
- } else {
- mr->ram_addr = qemu_ram_alloc(size, mr);
- }
+ mr->ram_addr = qemu_ram_alloc(size, mr);
}
+#ifdef __linux__
+void memory_region_init_ram_from_file(MemoryRegion *mr,
+ struct Object *owner,
+ const char *name,
+ uint64_t size,
+ const char *path)
+{
+ memory_region_init(mr, owner, name, size);
+ mr->ram = true;
+ mr->terminates = true;
+ mr->destructor = memory_region_destructor_ram;
+ mr->ram_addr = qemu_ram_alloc_from_file(size, mr, path);
+}
+#endif
+
void memory_region_init_ram_ptr(MemoryRegion *mr,
Object *owner,
const char *name,