[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] Pretend that the floppy is spinning between READ ID

From: Jan Jezabek
Subject: [Qemu-devel] [PATCH] Pretend that the floppy is spinning between READ ID requests
Date: Tue, 28 Aug 2007 18:00:17 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20070802 SeaMonkey/1.1.4


I have been investigating why Coherent (a discontinued UNIX clone) doesn't boot in QEMU (and in Bochs, VirtualBox, VirtualPC, etc.). The reason for this is a weird format detection routine used by its floppy driver. To check whether the sectors of the disk are interleaved and to determine the number of sectors per track it does the following:

- starts the motor,
- issues a READ ID request and remembers the reported sector number,
- issues subsequent READ ID requests until it finds the next logical sector (to see if the disk uses interleaving),
- issues even more READ ID requests until it reaches the first sector again.

The problem is that QEMU doesn't emulate the spinning of the disk - it always reports the same sector number. The procedure therefore times out. I have come up with a simple patch, which changes the current sector during each READ ID request. This allows Coherent to boot from the floppy. I have tested booting from an MS-DOS floppy and accessing a disk from Linux (2.4.26), and there seem to be no regressions.

The patch is attached. Any comments and suggestions are welcome.

Jan Jezabek
--- qemu-orig/hw/fdc.c  Mon Aug 20 19:51:42 2007
+++ qemu/hw/fdc.c       Tue Aug 28 15:46:31 2007
@@ -1843,5 +1843,13 @@
 static void fdctrl_result_timer(void *opaque)
     fdctrl_t *fdctrl = opaque;
+    fdrive_t *cur_drv = get_cur_drv(fdctrl);
+    /* Pretend we are spinning.
+     * This is needed for Coherent, which uses READ ID to check for
+     * sector interleaving.
+     */
+    if (cur_drv->last_sect != 0) {
+        cur_drv->sect = (cur_drv->sect % cur_drv->last_sect) + 1;
+    }
     fdctrl_stop_transfer(fdctrl, 0x00, 0x00, 0x00);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]