Commit 4157a662124c733ef94cb3b7fa3c849fdfb28c8e

Authored by bellard
1 parent 0289b2c1

allow variable bios size


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1496 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 6 additions and 5 deletions
hw/ppc_prep.c
@@ -526,7 +526,7 @@ static void ppc_prep_init(int ram_size, int vga_ram_size, int boot_device, @@ -526,7 +526,7 @@ static void ppc_prep_init(int ram_size, int vga_ram_size, int boot_device,
526 char buf[1024]; 526 char buf[1024];
527 m48t59_t *nvram; 527 m48t59_t *nvram;
528 int PPC_io_memory; 528 int PPC_io_memory;
529 - int ret, linux_boot, i, nb_nics1; 529 + int linux_boot, i, nb_nics1, bios_size;
530 unsigned long bios_offset; 530 unsigned long bios_offset;
531 uint32_t kernel_base, kernel_size, initrd_base, initrd_size; 531 uint32_t kernel_base, kernel_size, initrd_base, initrd_size;
532 ppc_def_t *def; 532 ppc_def_t *def;
@@ -544,13 +544,14 @@ static void ppc_prep_init(int ram_size, int vga_ram_size, int boot_device, @@ -544,13 +544,14 @@ static void ppc_prep_init(int ram_size, int vga_ram_size, int boot_device,
544 /* allocate and load BIOS */ 544 /* allocate and load BIOS */
545 bios_offset = ram_size + vga_ram_size; 545 bios_offset = ram_size + vga_ram_size;
546 snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME); 546 snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME);
547 - ret = load_image(buf, phys_ram_base + bios_offset);  
548 - if (ret != BIOS_SIZE) { 547 + bios_size = load_image(buf, phys_ram_base + bios_offset);
  548 + if (bios_size < 0 || bios_size > BIOS_SIZE) {
549 fprintf(stderr, "qemu: could not load PPC PREP bios '%s'\n", buf); 549 fprintf(stderr, "qemu: could not load PPC PREP bios '%s'\n", buf);
550 exit(1); 550 exit(1);
551 } 551 }
552 - cpu_register_physical_memory((uint32_t)(-BIOS_SIZE),  
553 - BIOS_SIZE, bios_offset | IO_MEM_ROM); 552 + bios_size = (bios_size + 0xfff) & ~0xfff;
  553 + cpu_register_physical_memory((uint32_t)(-bios_size),
  554 + bios_size, bios_offset | IO_MEM_ROM);
554 555
555 if (linux_boot) { 556 if (linux_boot) {
556 kernel_base = KERNEL_LOAD_ADDR; 557 kernel_base = KERNEL_LOAD_ADDR;