[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/4] prep: Add ELF support
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH 2/4] prep: Add ELF support |
Date: |
Tue, 14 Dec 2010 01:49:16 +0100 |
In order to switch from abondoned OpenHack'Ware to OpenBIOS firmware,
the PReP machine needs to be able to load an ELF BIOS.
ELF loading is adapted from ppc_newworld, the fallback mechanism from sun4m.
Note that since we must register the maximum amount of ROM before attempting
to load an ELF BIOS and since there is no cpu_unregister_physical_memory(),
raw BIOS files such as OHW may now be preceded by unused ROM memory.
Cc: Alexander Graf <address@hidden>
Cc: Hervé Poussineau <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
hw/ppc_prep.c | 24 +++++++++++++++---------
1 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c
index 6b22122..3575dee 100644
--- a/hw/ppc_prep.c
+++ b/hw/ppc_prep.c
@@ -36,6 +36,7 @@
#include "qemu-log.h"
#include "ide.h"
#include "loader.h"
+#include "elf.h"
#include "mc146818rtc.h"
#include "blockdev.h"
@@ -582,18 +583,23 @@ static void ppc_prep_init (ram_addr_t ram_size,
bios_name = BIOS_FILENAME;
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
if (filename) {
- bios_size = get_image_size(filename);
+ cpu_register_physical_memory(0xfff00000, BIOS_SIZE,
+ bios_offset | IO_MEM_ROM);
+ bios_size = load_elf(filename, NULL, NULL, NULL,
+ NULL, NULL, 1, ELF_MACHINE, 0);
+ if (bios_size < 0 || bios_size > BIOS_SIZE) {
+ bios_size = get_image_size(filename);
+ if (bios_size > 0 && bios_size <= BIOS_SIZE) {
+ target_phys_addr_t bios_addr;
+ bios_size = (bios_size + 0xfff) & ~0xfff;
+ bios_addr = (uint32_t)(-bios_size);
+ bios_size = load_image_targphys(filename, bios_addr,
+ bios_size);
+ }
+ }
} else {
bios_size = -1;
}
- if (bios_size > 0 && bios_size <= BIOS_SIZE) {
- target_phys_addr_t bios_addr;
- bios_size = (bios_size + 0xfff) & ~0xfff;
- bios_addr = (uint32_t)(-bios_size);
- cpu_register_physical_memory(bios_addr, bios_size,
- bios_offset | IO_MEM_ROM);
- bios_size = load_image_targphys(filename, bios_addr, bios_size);
- }
if (bios_size < 0 || bios_size > BIOS_SIZE) {
hw_error("qemu: could not load PPC PREP bios '%s'\n", bios_name);
}
--
1.7.3
- [Qemu-devel] [PATCH 0/4] ppc: Fix PReP emulation, Andreas Färber, 2010/12/13
- [Qemu-devel] [PATCH 1/4] prep: Remove bogus BIOS size check, Andreas Färber, 2010/12/13
- [Qemu-devel] [PATCH 2/4] prep: Add ELF support,
Andreas Färber <=
- [Qemu-devel] [PATCH, RFC 3/4] prep: Fix duplicate ISA IDE IRQ, Andreas Färber, 2010/12/13
- [Qemu-devel] [FYI 4/4] prep: Quickfix for ioport, Andreas Färber, 2010/12/13
- Re: [Qemu-devel] [FYI 4/4] prep: Quickfix for ioport, Andreas Färber, 2010/12/26
- Re: [Qemu-devel] [FYI 4/4] prep: Quickfix for ioport, Alexander Graf, 2010/12/26
- Re: [Qemu-devel] [FYI 4/4] prep: Quickfix for ioport, Andreas Färber, 2010/12/26
- Re: [Qemu-devel] [PATCH, RFC 3/4] prep: Fix duplicate ISA IDE IRQ, Andreas Färber, 2010/12/20
- Re: [Qemu-devel] [PATCH, RFC 3/4] prep: Fix duplicate ISA IDE IRQ, Alexander Graf, 2010/12/20
[Qemu-devel] Re: [PATCH 1/4] prep: Remove bogus BIOS size check, Alexander Graf, 2010/12/19