[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 for-4.0 3/3] elf_ops.h: Use address_space_wri
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [Qemu-devel] [PATCH v2 for-4.0 3/3] elf_ops.h: Use address_space_write() to write memory |
Date: |
Thu, 22 Nov 2018 23:28:20 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 |
On 22/11/18 18:26, Peter Maydell wrote:
> 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 <address@hidden>
> ---
> v1->v2: handle NULL as
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> include/hw/elf_ops.h | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h
> index 81cecaf27e2..74679ff8da3 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);
> }
> }
>