Revision dcac9679 hw/ppc_prep.c

b/hw/ppc_prep.c
588 588
    if (bios_name == NULL)
589 589
        bios_name = BIOS_FILENAME;
590 590
    snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
591
    bios_size = load_image(buf, phys_ram_base + bios_offset);
591
    bios_size = get_image_size(buf);
592
    if (bios_size > 0 && bios_size <= BIOS_SIZE) {
593
        target_phys_addr_t bios_addr;
594
        bios_size = (bios_size + 0xfff) & ~0xfff;
595
        bios_addr = (uint32_t)(-bios_size);
596
        cpu_register_physical_memory(bios_addr, bios_size,
597
                                     bios_offset | IO_MEM_ROM);
598
        bios_size = load_image_targphys(buf, bios_addr, bios_size);
599
    }
592 600
    if (bios_size < 0 || bios_size > BIOS_SIZE) {
593 601
        cpu_abort(env, "qemu: could not load PPC PREP bios '%s'\n", buf);
594 602
        exit(1);
......
596 604
    if (env->nip < 0xFFF80000 && bios_size < 0x00100000) {
597 605
        cpu_abort(env, "PowerPC 601 / 620 / 970 need a 1MB BIOS\n");
598 606
    }
599
    bios_size = (bios_size + 0xfff) & ~0xfff;
600
    cpu_register_physical_memory((uint32_t)(-bios_size),
601
                                 bios_size, bios_offset | IO_MEM_ROM);
602 607

  
603 608
    if (linux_boot) {
604 609
        kernel_base = KERNEL_LOAD_ADDR;
605 610
        /* now we can load the kernel */
606
        kernel_size = load_image(kernel_filename, phys_ram_base + kernel_base);
611
        kernel_size = load_image_targphys(kernel_filename, kernel_base,
612
                                          ram_size - kernel_base);
607 613
        if (kernel_size < 0) {
608 614
            cpu_abort(env, "qemu: could not load kernel '%s'\n",
609 615
                      kernel_filename);
......
612 618
        /* load initrd */
613 619
        if (initrd_filename) {
614 620
            initrd_base = INITRD_LOAD_ADDR;
615
            initrd_size = load_image(initrd_filename,
616
                                     phys_ram_base + initrd_base);
621
            initrd_size = load_image_targphys(initrd_filename, initrd_base,
622
                                              ram_size - initrd_base);
617 623
            if (initrd_size < 0) {
618 624
                cpu_abort(env, "qemu: could not load initial ram disk '%s'\n",
619 625
                          initrd_filename);

Also available in: Unified diff