diff options
Diffstat (limited to 'hw/ppc_oldworld.c')
-rw-r--r-- | hw/ppc_oldworld.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c index aeac6aed30..b2c329b74f 100644 --- a/hw/ppc_oldworld.c +++ b/hw/ppc_oldworld.c @@ -122,7 +122,7 @@ static void ppc_heathrow_init (ram_addr_t ram_size, const char *cpu_model) { CPUState *env = NULL, *envs[MAX_CPUS]; - char buf[1024]; + char *filename; qemu_irq *pic, **heathrow_irqs; int linux_boot, i; ram_addr_t ram_offset, bios_offset, vga_bios_offset; @@ -173,24 +173,35 @@ static void ppc_heathrow_init (ram_addr_t ram_size, bios_offset = qemu_ram_alloc(BIOS_SIZE); if (bios_name == NULL) bios_name = PROM_FILENAME; - snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name); + filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); cpu_register_physical_memory(PROM_ADDR, BIOS_SIZE, bios_offset | IO_MEM_ROM); /* Load OpenBIOS (ELF) */ - bios_size = load_elf(buf, 0, NULL, NULL, NULL); + if (filename) { + bios_size = load_elf(filename, 0, NULL, NULL, NULL); + qemu_free(filename); + } else { + bios_size = -1; + } if (bios_size < 0 || bios_size > BIOS_SIZE) { - hw_error("qemu: could not load PowerPC bios '%s'\n", buf); + hw_error("qemu: could not load PowerPC bios '%s'\n", bios_name); exit(1); } /* allocate and load VGA BIOS */ vga_bios_offset = qemu_ram_alloc(VGA_BIOS_SIZE); vga_bios_ptr = qemu_get_ram_ptr(vga_bios_offset); - snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME); - vga_bios_size = load_image(buf, vga_bios_ptr + 8); + filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, VGABIOS_FILENAME); + if (filename) { + vga_bios_size = load_image(filename, vga_bios_ptr + 8); + qemu_free(filename); + } else { + vga_bios_size = -1; + } if (vga_bios_size < 0) { /* if no bios is present, we can still work */ - fprintf(stderr, "qemu: warning: could not load VGA bios '%s'\n", buf); + fprintf(stderr, "qemu: warning: could not load VGA bios '%s'\n", + VGABIOS_FILENAME); vga_bios_size = 0; } else { /* set a specific header (XXX: find real Apple format for NDRV |