]> git.proxmox.com Git - mirror_qemu.git/blobdiff - hw/core/loader.c
Merge remote-tracking branch 'remotes/jovanovic/mips-ufrp' into staging
[mirror_qemu.git] / hw / core / loader.c
index 60d2ebd4ac85d98079fd65cf3d5d955709ca02f3..e1c3f3a8609fd8f55f749fa5e7fad4f71af3948e 100644 (file)
@@ -778,13 +778,21 @@ static void rom_reset(void *unused)
             void *host = memory_region_get_ram_ptr(rom->mr);
             memcpy(host, rom->data, rom->datasize);
         } else {
-            cpu_physical_memory_write_rom(rom->addr, rom->data, rom->datasize);
+            cpu_physical_memory_write_rom(&address_space_memory,
+                                          rom->addr, rom->data, rom->datasize);
         }
         if (rom->isrom) {
             /* rom needs to be written only once */
             g_free(rom->data);
             rom->data = NULL;
         }
+        /*
+         * The rom loader is really on the same level as firmware in the guest
+         * shadowing a ROM into RAM. Such a shadowing mechanism needs to ensure
+         * that the instruction cache for that new region is clear, so that the
+         * CPU definitely fetches its instructions from the just written data.
+         */
+        cpu_flush_icache_range(rom->addr, rom->datasize);
     }
 }