summary refs log tree commit diff stats
path: root/include/hw/elf_ops.h
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2022-01-20 11:43:28 +0000
committerPeter Maydell <peter.maydell@linaro.org>2022-01-20 11:43:28 +0000
commit47fa1ad5349bee5c2b47f8b1dc3be13f180c89ba (patch)
tree7ef4edd2caa8a8bd72d97c1101081e76dc1afde9 /include/hw/elf_ops.h
parentb10d00d8811fa4eed4862963273d7353ce310c82 (diff)
parente48b140eef9775986cc18038c7bc68f8d2b7fe1d (diff)
downloadfocaccia-qemu-47fa1ad5349bee5c2b47f8b1dc3be13f180c89ba.tar.gz
focaccia-qemu-47fa1ad5349bee5c2b47f8b1dc3be13f180c89ba.zip
Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-7.0-pull-request' into staging
m68k pull request 20220120

Fix virt-m68k reboot

# gpg: Signature made Thu 20 Jan 2022 08:35:50 GMT
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier/tags/m68k-for-7.0-pull-request:
  m68k: virt: correctly set the initial PC
  hw/elf_ops: clear uninitialized segment space
  exec/memory: Extract address_space_set() from dma_memory_set()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include/hw/elf_ops.h')
-rw-r--r--include/hw/elf_ops.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h
index 995de8495c..7c3b1d0f6c 100644
--- a/include/hw/elf_ops.h
+++ b/include/hw/elf_ops.h
@@ -555,6 +555,19 @@ static ssize_t glue(load_elf, SZ)(const char *name, int fd,
                     if (res != MEMTX_OK) {
                         goto fail;
                     }
+                    /*
+                     * We need to zero'ify the space that is not copied
+                     * from file
+                     */
+                    if (file_size < mem_size) {
+                        res = address_space_set(as ? as : &address_space_memory,
+                                                addr + file_size, 0,
+                                                mem_size - file_size,
+                                                MEMTXATTRS_UNSPECIFIED);
+                        if (res != MEMTX_OK) {
+                            goto fail;
+                        }
+                    }
                 }
             }