If the memory is set using a file, and PC is specified on the command
line, it will be overwritten with the value 'entry'. This is not only
illogical, but also incorrect, because the load_ * functions do not take
into account the specifics of the ARM-M PC.

Signed-off-by: Julia Suvorova <jus...@mail.ru>
---
 hw/core/generic-loader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c
index fbae05fb3b..fc81fd8e14 100644
--- a/hw/core/generic-loader.c
+++ b/hw/core/generic-loader.c
@@ -152,7 +152,7 @@ static void generic_loader_realize(DeviceState *dev, Error 
**errp)
         if (size < 0 || s->force_raw) {
             /* Default to the maximum size being the machine's ram size */
             size = load_image_targphys_as(s->file, s->addr, ram_size, as);
-        } else {
+        } else if (!s->addr) {
             s->addr = entry;
         }
 
-- 
2.17.1


Reply via email to