2010/3/8 Roy Tam <roy...@gmail.com>:
> 2010/3/8 Roy Tam <roy...@gmail.com>:
>> the following hack reenables QEMU/Bochs BIOS booting with -vga std
>> (for both pc and isapc):
>
> a more complete hack, cirrus vga will work too:

instead of hacking each vga source, adding new option seems better.
---
diff --git a/hw/pc.c b/hw/pc.c
index e50a488..d32ad85 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -53,6 +53,9 @@

 #define PC_MAX_BIOS_SIZE (4 * 1024 * 1024)

+#define VGABIOS_FILENAME "vgabios.bin"
+#define VGABIOS_CIRRUS_FILENAME "vgabios-cirrus.bin"
+
 /* Leave a chunk of memory at the top of RAM for the BIOS ACPI tables.  */
 #define ACPI_DATA_SIZE       0x10000
 #define BIOS_CFG_IOPORT 0x510
@@ -929,17 +932,26 @@ static void pc_init1(ram_addr_t ram_size,
         } else {
             isa_cirrus_vga_init();
         }
+        if (old_bios_support) {
+            rom_add_file_fixed(VGABIOS_CIRRUS_FILENAME, 0xc0000);
+        }
     } else if (vmsvga_enabled) {
         if (pci_enabled)
             pci_vmsvga_init(pci_bus);
         else
             fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __FUNCTION__);
+        if (old_bios_support) {
+            rom_add_file_fixed(VGABIOS_FILENAME, 0xc0000);
+        }
     } else if (std_vga_enabled) {
         if (pci_enabled) {
             pci_vga_init(pci_bus, 0, 0);
         } else {
             isa_vga_init();
         }
+        if (old_bios_support) {
+            rom_add_file_fixed(VGABIOS_FILENAME, 0xc0000);
+        }
     }

     rtc_state = rtc_init(2000);
diff --git a/hw/pc.h b/hw/pc.h
index d54959a..d318ddd 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -91,6 +91,7 @@ void cmos_set_s3_resume(void);

 /* pc.c */
 extern int fd_bootchk;
+extern int old_bios_support;

 void ioport_set_a20(int enable);
 int ioport_get_a20(void);
diff --git a/qemu-options.hx b/qemu-options.hx
index fd50add..afe2545 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -769,6 +769,16 @@ slows down the IDE transfers).
 ETEXI

 #ifdef TARGET_I386
+DEF("old-bios", 0, QEMU_OPTION_old_bios,
+    "-old-bios       use it for Bochs/QEMU BIOS\n")
+#endif
+STEXI
+...@item -old-bios
+...@findex -old-bios
+Use it when combine with old Bochs/QEMU BIOS for debugging.
+ETEXI
+
+#ifdef TARGET_I386
 HXCOMM Deprecated by -rtc
 DEF("rtc-td-hack", 0, QEMU_OPTION_rtc_td_hack, "")
 #endif
diff --git a/vl.c b/vl.c
index d8328c7..0d7ec83 100644
--- a/vl.c
+++ b/vl.c
@@ -217,6 +217,7 @@ CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES];
 #ifdef TARGET_I386
 int win2k_install_hack = 0;
 int rtc_td_hack = 0;
+int old_bios_support = 0;
 #endif
 int usb_enabled = 0;
 int singlestep = 0;
@@ -5180,6 +5181,9 @@ int main(int argc, char **argv, char **envp)
             case QEMU_OPTION_no_fd_bootchk:
                 fd_bootchk = 0;
                 break;
+            case QEMU_OPTION_old_bios:
+                old_bios_support = 1;
+                break;
 #endif
             case QEMU_OPTION_netdev:
                 if (net_client_parse(&qemu_netdev_opts, optarg) == -1) {


Reply via email to