Index: hw/ppc_prep.c
===================================================================
RCS file: /sources/qemu/qemu/hw/ppc_prep.c,v
retrieving revision 1.59
diff -c -r1.59 ppc_prep.c
*** hw/ppc_prep.c	2 Dec 2007 04:51:09 -0000	1.59
--- hw/ppc_prep.c	11 Dec 2007 14:14:27 -0000
***************
*** 546,554 ****
      char buf[1024];
      nvram_t nvram;
      m48t59_t *m48t59;
!     int PPC_io_memory;
!     int linux_boot, i, nb_nics1, bios_size;
!     unsigned long bios_offset;
      uint32_t kernel_base, kernel_size, initrd_base, initrd_size;
      PCIBus *pci_bus;
      qemu_irq *i8259;
--- 546,554 ----
      char buf[1024];
      nvram_t nvram;
      m48t59_t *m48t59;
!     int PPC_io_memory, ret;
!     ram_addr_t ram_addr, vga_ram_addr, bios_offset;
!     int linux_boot, i, nb_nics1, bios_size, bios_size_round;
      uint32_t kernel_base, kernel_size, initrd_base, initrd_size;
      PCIBus *pci_bus;
      qemu_irq *i8259;
***************
*** 585,608 ****
      }
  
      /* allocate RAM */
!     cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);
  
      /* allocate and load BIOS */
-     bios_offset = ram_size + vga_ram_size;
      if (bios_name == NULL)
          bios_name = BIOS_FILENAME;
      snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
!     bios_size = load_image(buf, phys_ram_base + bios_offset);
!     if (bios_size < 0 || bios_size > BIOS_SIZE) {
!         cpu_abort(env, "qemu: could not load PPC PREP bios '%s'\n", buf);
!         exit(1);
!     }
      if (env->nip < 0xFFF80000 && bios_size < 0x00100000) {
          cpu_abort(env, "PowerPC 601 / 620 / 970 need a 1MB BIOS\n");
      }
!     bios_size = (bios_size + 0xfff) & ~0xfff;
!     cpu_register_physical_memory((uint32_t)(-bios_size),
!                                  bios_size, bios_offset | IO_MEM_ROM);
  
      if (linux_boot) {
          kernel_base = KERNEL_LOAD_ADDR;
--- 585,616 ----
      }
  
      /* allocate RAM */
!     ram_addr = qemu_ram_alloc(ram_size);
!     cpu_register_physical_memory(0, ram_size, ram_addr | IO_MEM_RAM);
! 
!     /* allocate VGA RAM */
!     vga_ram_addr = qemu_ram_alloc(vga_ram_size);
  
      /* allocate and load BIOS */
      if (bios_name == NULL)
          bios_name = BIOS_FILENAME;
      snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
!     bios_size = get_image_size(buf);
!     if (bios_size < 0)
! 	goto bios_error;
      if (env->nip < 0xFFF80000 && bios_size < 0x00100000) {
          cpu_abort(env, "PowerPC 601 / 620 / 970 need a 1MB BIOS\n");
      }
!     bios_size_round = (bios_size + 0xfff) & ~0xfff;
!     bios_offset = qemu_ram_alloc(bios_size_round);
!     ret = load_image(buf, phys_ram_base + bios_offset);
!     if (ret != bios_size) {
!     bios_error:
!         cpu_abort(env, "qemu: could not load PPC PREP bios '%s'\n", buf);
!         exit(1);
!     }
!     cpu_register_physical_memory((uint32_t)(-bios_size_round),
!                                  bios_size_round, bios_offset | IO_MEM_ROM);
  
      if (linux_boot) {
          kernel_base = KERNEL_LOAD_ADDR;
***************
*** 661,667 ****
      cpu_register_physical_memory(0x80000000, 0x00800000, PPC_io_memory);
  
      /* init basic PC hardware */
!     pci_vga_init(pci_bus, ds, phys_ram_base + ram_size, ram_size,
                   vga_ram_size, 0, 0);
      //    openpic = openpic_init(0x00000000, 0xF0000000, 1);
      //    pit = pit_init(0x40, i8259[0]);
--- 669,675 ----
      cpu_register_physical_memory(0x80000000, 0x00800000, PPC_io_memory);
  
      /* init basic PC hardware */
!     pci_vga_init(pci_bus, ds, phys_ram_base + vga_ram_addr, vga_ram_addr,
                   vga_ram_size, 0, 0);
      //    openpic = openpic_init(0x00000000, 0xF0000000, 1);
      //    pit = pit_init(0x40, i8259[0]);
