aboutsummaryrefslogtreecommitdiffstats
path: root/hw/loader.c
diff options
context:
space:
mode:
authorKevin Wolf <mail@kevin-wolf.de>2009-12-19 21:15:20 +0100
committerAurelien Jarno <aurelien@aurel32.net>2009-12-19 21:49:39 +0100
commit935effc2bbd2c441b755a8d280811a9763fdb98c (patch)
treeb880f6260343868f2af9b41fb0abc7dfc739bf2f /hw/loader.c
parent7631c97ec9648da7b3420a925e8d95e8bd3f444e (diff)
Multiboot support: Fix rom_copy
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>
Diffstat (limited to 'hw/loader.c')
-rw-r--r--hw/loader.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/hw/loader.c b/hw/loader.c
index c7d43f6c1..2ceb8eba4 100644
--- a/hw/loader.c
+++ b/hw/loader.c
@@ -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)