aboutsummaryrefslogtreecommitdiff
path: root/include/hw/elf_ops.h
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-12-14 13:30:49 +0000
committerPeter Maydell <peter.maydell@linaro.org>2018-12-14 13:30:49 +0000
commited31504097cd038097a720efd82a69273c04cf61 (patch)
tree52cd836b0763bcebc03858c51fe34f2709f1341a /include/hw/elf_ops.h
parent6f89ae5816e38cd93419d2c8e8465b6dea00abee (diff)
elf_ops.h: Use address_space_write() to write memory
Currently the load_elf function in elf_ops.h uses cpu_physical_memory_write() to write the ELF file to memory if it is not handling it as a ROM blob. This means we ignore the AddressSpace that the function is passed to define where it should be loaded. Use address_space_write() instead. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20181122172653.3413-4-peter.maydell@linaro.org
Diffstat (limited to 'include/hw/elf_ops.h')
-rw-r--r--include/hw/elf_ops.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h
index 81cecaf27e..74679ff8da 100644
--- a/include/hw/elf_ops.h
+++ b/include/hw/elf_ops.h
@@ -482,7 +482,9 @@ static int glue(load_elf, SZ)(const char *name, int fd,
rom_add_elf_program(label, data, file_size, mem_size,
addr, as);
} else {
- cpu_physical_memory_write(addr, data, file_size);
+ address_space_write(as ? as : &address_space_memory,
+ addr, MEMTXATTRS_UNSPECIFIED,
+ data, file_size);
g_free(data);
}
}