]> git.proxmox.com Git - qemu.git/commitdiff
Windows 2000 install disk full hack (original idea from Vladimir N. Oleynik)
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Sat, 30 Apr 2005 16:10:35 +0000 (16:10 +0000)
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Sat, 30 Apr 2005 16:10:35 +0000 (16:10 +0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1428 c046a42c-6fe2-441c-8c8c-71466251a162

Changelog
hw/ide.c
vl.c
vl.h

index 761a91d475c1effb013cdfcb8e617947902c9ffb..bea8f8b3ee5f4f75dfb6681c81a0cf71908db084 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,8 @@
 version 0.7.1:
 
   - read-only Virtual FAT support (Johannes Schindelin)
+  - Windows 2000 install disk full hack (original idea from Vladimir
+    N. Oleynik)
 
 version 0.7.0:
 
index d2220ba0b6ec069dd2f7f543cc94bccdaea50821..49039e7eb39e4e4194bf8c7d2046fa74a8cb40c3 100644 (file)
--- a/hw/ide.c
+++ b/hw/ide.c
@@ -332,6 +332,7 @@ typedef struct IDEState {
     uint8_t *data_ptr;
     uint8_t *data_end;
     uint8_t io_buffer[MAX_MULT_SECTORS*512 + 4];
+    QEMUTimer *sector_write_timer; /* only used for win2k instal hack */
 } IDEState;
 
 #define BM_STATUS_DMAING 0x01
@@ -645,6 +646,12 @@ static void ide_sector_read_dma(IDEState *s)
     ide_dma_start(s, ide_read_dma_cb);
 }
 
+static void ide_sector_write_timer_cb(void *opaque)
+{
+    IDEState *s = opaque;
+    ide_set_irq(s);
+}
+
 static void ide_sector_write(IDEState *s)
 {
     int64_t sector_num;
@@ -670,7 +677,22 @@ static void ide_sector_write(IDEState *s)
         ide_transfer_start(s, s->io_buffer, 512 * n1, ide_sector_write);
     }
     ide_set_sector(s, sector_num + n);
-    ide_set_irq(s);
+    
+#ifdef TARGET_I386
+    if (win2k_install_hack) {
+        /* It seems there is a bug in the Windows 2000 installer HDD
+           IDE driver which fills the disk with empty logs when the
+           IDE write IRQ comes too early. This hack tries to correct
+           that at the expense of slower write performances. Use this
+           option _only_ to install Windows 2000. You must disable it
+           for normal use. */
+        qemu_mod_timer(s->sector_write_timer, 
+                       qemu_get_clock(vm_clock) + (ticks_per_sec / 1000));
+    } else 
+#endif
+    {
+        ide_set_irq(s);
+    }
 }
 
 static int ide_write_dma_cb(IDEState *s, 
@@ -1939,6 +1961,8 @@ static void ide_init2(IDEState *ide_state, int irq,
         }
         s->drive_serial = drive_serial++;
         s->irq = irq;
+        s->sector_write_timer = qemu_new_timer(vm_clock, 
+                                               ide_sector_write_timer_cb, s);
         ide_reset(s);
     }
 }
diff --git a/vl.c b/vl.c
index 40c0c0afdb28442ac4c7ddb228d9596ef180772d..5c62e731509c46c24450bc54473e0796f455494b 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -147,6 +147,9 @@ int full_screen = 0;
 TextConsole *vga_console;
 CharDriverState *serial_hds[MAX_SERIAL_PORTS];
 CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
+#ifdef TARGET_I386
+int win2k_install_hack = 0;
+#endif
 
 /***********************************************************/
 /* x86 ISA bus support */
@@ -933,7 +936,7 @@ static void init_timers(void)
         
         /* timer signal */
         sigfillset(&act.sa_mask);
-        act.sa_flags = 0;
+       act.sa_flags = 0;
 #if defined (TARGET_I386) && defined(USE_CODE_COPY)
         act.sa_flags |= SA_ONSTACK;
 #endif
@@ -2746,6 +2749,9 @@ void help(void)
            "-enable-audio   enable audio support\n"
            "-localtime      set the real time clock to local time [default=utc]\n"
            "-full-screen    start in full screen\n"
+#ifdef TARGET_I386
+           "-win2k-hack     use it when installing Windows 2000 to avoid a disk full bug\n"
+#endif
 #ifdef TARGET_PPC
            "-prep           Simulate a PREP system (default is PowerMAC)\n"
 #endif
@@ -2878,6 +2884,7 @@ enum {
     QEMU_OPTION_full_screen,
     QEMU_OPTION_pidfile,
     QEMU_OPTION_no_kqemu,
+    QEMU_OPTION_win2k_hack,
 };
 
 typedef struct QEMUOption {
@@ -2946,7 +2953,8 @@ const QEMUOption qemu_options[] = {
     { "loadvm", HAS_ARG, QEMU_OPTION_loadvm },
     { "full-screen", 0, QEMU_OPTION_full_screen },
     { "pidfile", HAS_ARG, QEMU_OPTION_pidfile },
-
+    { "win2k-hack", 0, QEMU_OPTION_win2k_hack },
+    
     /* temporary options */
     { "pci", 0, QEMU_OPTION_pci },
     { "cirrusvga", 0, QEMU_OPTION_cirrusvga },
@@ -3397,6 +3405,11 @@ int main(int argc, char **argv)
             case QEMU_OPTION_pidfile:
                 create_pidfile(optarg);
                 break;
+#ifdef TARGET_I386
+            case QEMU_OPTION_win2k_hack:
+                win2k_install_hack = 1;
+                break;
+#endif
 #ifdef USE_KQEMU
             case QEMU_OPTION_no_kqemu:
                 kqemu_allowed = 0;
diff --git a/vl.h b/vl.h
index 12bebe6b0435d3846da68a5d638c5b8a17f32a55..21d4bf8e1104f650fb8a4343ca052bf59d4787d4 100644 (file)
--- a/vl.h
+++ b/vl.h
@@ -126,6 +126,7 @@ extern int graphic_height;
 extern int graphic_depth;
 extern const char *keyboard_layout;
 extern int kqemu_allowed;
+extern int win2k_install_hack;
 
 /* XXX: make it dynamic */
 #if defined (TARGET_PPC)