]> git.proxmox.com Git - mirror_qemu.git/commitdiff
Multiboot support: Fix rom_copy
authorKevin Wolf <mail@kevin-wolf.de>
Sat, 19 Dec 2009 20:15:20 +0000 (21:15 +0100)
committerAurelien Jarno <aurelien@aurel32.net>
Sat, 19 Dec 2009 20:49:39 +0000 (21:49 +0100)
ROMs need to be loaded if they are anywhere in the requested area, not
only at the very beginning. This fixes Multiboot with ELF kernels that
have more than one program header.

Signed-off-by: Kevin Wolf <mail@kevin-wolf.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
hw/loader.c

index c7d43f6c1fc0a4496f8dc0945dc1733e72b1768a..2ceb8eba48cf9a06b925b905cac41bb1b670923c 100644 (file)
@@ -698,6 +698,11 @@ static Rom *find_rom(target_phys_addr_t addr)
     return NULL;
 }
 
+/*
+ * Copies memory from registered ROMs to dest. Any memory that is contained in
+ * a ROM between addr and addr + size is copied. Note that this can involve
+ * multiple ROMs, which need not start at addr and need not end at addr + size.
+ */
 int rom_copy(uint8_t *dest, target_phys_addr_t addr, size_t size)
 {
     target_phys_addr_t end = addr + size;
@@ -706,8 +711,6 @@ int rom_copy(uint8_t *dest, target_phys_addr_t addr, size_t size)
     Rom *rom;
 
     QTAILQ_FOREACH(rom, &roms, next) {
-        if (rom->addr > addr)
-            continue;
         if (rom->addr + rom->romsize < addr)
             continue;
         if (rom->addr > end)