[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 3/3] hw/core/loader: Warn if we fail to load ROM regions at re
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v3 3/3] hw/core/loader: Warn if we fail to load ROM regions at reset |
Date: |
Thu, 20 May 2021 07:15:42 +0200 |
If the user provides an ELF file that's been linked to a wrong
address, we try to load it, fails, and keep going silently.
Instead,
Display a warning instead, but keep going to not disrupt users
accidentally relying on this 'continues-anyway' behaviour.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/core/loader.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/hw/core/loader.c b/hw/core/loader.c
index b3c4a654b45..37a2f2c4959 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -1147,8 +1147,16 @@ static void rom_reset(void *unused)
void *host = memory_region_get_ram_ptr(rom->mr);
memcpy(host, rom->data, rom->datasize);
} else {
- address_space_write_rom(rom->as, rom->addr, MEMTXATTRS_UNSPECIFIED,
- rom->data, rom->datasize);
+ MemTxResult res;
+
+ res = address_space_write_rom(rom->as, rom->addr,
+ MEMTXATTRS_UNSPECIFIED,
+ rom->data, rom->datasize);
+ if (res != MEMTX_OK) {
+ warn_report("rom: unable to write data (file '%s', "
+ "addr=0x" TARGET_FMT_plx ", size=0x%zu)",
+ rom->name, rom->addr, rom->datasize);
+ }
}
if (rom->isrom) {
/* rom needs to be written only once */
--
2.26.3