On 28.04.2013, at 02:32, Andreas Färber wrote:

> This prepares for switching from OpenHack'Ware to OpenBIOS.
> 
> Signed-off-by: Andreas Färber <andreas.faer...@web.de>
> ---
> hw/ppc/prep.c | 21 +++++++++++++--------
> 1 file changed, 13 insertions(+), 8 deletions(-)
> 
> diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
> index cceab3e..9bb0119 100644
> --- a/hw/ppc/prep.c
> +++ b/hw/ppc/prep.c
> @@ -41,6 +41,7 @@
> #include "sysemu/blockdev.h"
> #include "sysemu/arch_init.h"
> #include "exec/address-spaces.h"
> +#include "elf.h"
> 
> //#define HARD_DEBUG_PPC_IO
> //#define DEBUG_PPC_IO
> @@ -502,18 +503,22 @@ static void ppc_prep_init(QEMUMachineInitArgs *args)
>         bios_name = BIOS_FILENAME;
>     filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
>     if (filename) {
> -        bios_size = get_image_size(filename);
> +        bios_size = load_elf(filename, NULL, NULL, NULL,
> +                             NULL, NULL, 1, ELF_MACHINE, 0);

This leaves bios_addr unset, no?

> +        if (bios_size < 0) {
> +            bios_size = get_image_size(filename);
> +            if (bios_size > 0 && bios_size <= BIOS_SIZE) {
> +                hwaddr 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) {
> -        hwaddr bios_addr;
> -        bios_size = (bios_size + 0xfff) & ~0xfff;
> -        bios_addr = (uint32_t)(-bios_size);
> -        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);
> +        fprintf(stderr, "qemu: could not load PPC PREP bios '%s'\n", 
> bios_name);

You probably want to split this up. Bios_size < 0 means that image loading 
failed, which is always a fatal error. Bios_size > BIOS_SIZE should only really 
apply to flat image loading, I think.


Alex

>     }
>     if (filename) {
>         g_free(filename);
> -- 
> 1.8.1.4
> 


Reply via email to