aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2019-02-07 14:20:46 +0000
committerPeter Maydell <peter.maydell@linaro.org>2019-02-07 14:20:46 +0000
commit632351e0e1a861f2eaf709b053c53f96a1225825 (patch)
tree3636387d8e927193348c8c8f820f1813c7e45a8d
parent1dca0549557caf962dc12dc0c225a98a6f2d5fa7 (diff)
parente17bebd049d78f489c2cff755e2b66a0536a156e (diff)
downloadqemu-632351e0e1a861f2eaf709b053c53f96a1225825.zip
qemu-632351e0e1a861f2eaf709b053c53f96a1225825.tar.gz
qemu-632351e0e1a861f2eaf709b053c53f96a1225825.tar.bz2
Merge remote-tracking branch 'remotes/elmarco/tags/dump-pull-request' into staging
Pull request # gpg: Signature made Wed 06 Feb 2019 14:57:54 GMT # gpg: using RSA key DAE8E10975969CE5 # gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" [full] # gpg: aka "Marc-André Lureau <marcandre.lureau@gmail.com>" [full] # Primary key fingerprint: 87A9 BD93 3F87 C606 D276 F62D DAE8 E109 7596 9CE5 * remotes/elmarco/tags/dump-pull-request: dump: Set correct vaddr for ELF dump Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--dump.c5
-rw-r--r--scripts/dump-guest-memory.py1
2 files changed, 4 insertions, 2 deletions
diff --git a/dump.c b/dump.c
index ef1d802..107a671 100644
--- a/dump.c
+++ b/dump.c
@@ -192,7 +192,7 @@ static void write_elf64_load(DumpState *s, MemoryMapping *memory_mapping,
phdr.p_paddr = cpu_to_dump64(s, memory_mapping->phys_addr);
phdr.p_filesz = cpu_to_dump64(s, filesz);
phdr.p_memsz = cpu_to_dump64(s, memory_mapping->length);
- phdr.p_vaddr = cpu_to_dump64(s, memory_mapping->virt_addr);
+ phdr.p_vaddr = cpu_to_dump64(s, memory_mapping->virt_addr) ?: phdr.p_paddr;
assert(memory_mapping->length >= filesz);
@@ -216,7 +216,8 @@ static void write_elf32_load(DumpState *s, MemoryMapping *memory_mapping,
phdr.p_paddr = cpu_to_dump32(s, memory_mapping->phys_addr);
phdr.p_filesz = cpu_to_dump32(s, filesz);
phdr.p_memsz = cpu_to_dump32(s, memory_mapping->length);
- phdr.p_vaddr = cpu_to_dump32(s, memory_mapping->virt_addr);
+ phdr.p_vaddr =
+ cpu_to_dump32(s, memory_mapping->virt_addr) ?: phdr.p_paddr;
assert(memory_mapping->length >= filesz);
diff --git a/scripts/dump-guest-memory.py b/scripts/dump-guest-memory.py
index 198cd0f..2c587cb 100644
--- a/scripts/dump-guest-memory.py
+++ b/scripts/dump-guest-memory.py
@@ -163,6 +163,7 @@ class ELF(object):
phdr = get_arch_phdr(self.endianness, self.elfclass)
phdr.p_type = p_type
phdr.p_paddr = p_paddr
+ phdr.p_vaddr = p_paddr
phdr.p_filesz = p_size
phdr.p_memsz = p_size
self.segments.append(phdr)