Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IQ3Vd-0003cG-2S for qemu-devel@nongnu.org; Tue, 28 Aug 2007 12:01:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IQ3Vc-0003bS-1s for qemu-devel@nongnu.org; Tue, 28 Aug 2007 12:01:40 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IQ3Vb-0003bD-R5 for qemu-devel@nongnu.org; Tue, 28 Aug 2007 12:01:39 -0400 Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IQ3Vb-0006vU-7i for qemu-devel@nongnu.org; Tue, 28 Aug 2007 12:01:39 -0400 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1IQ3VT-0000rZ-7T for qemu-devel@nongnu.org; Tue, 28 Aug 2007 18:01:31 +0200 Received: from jezabek.net.autocom.pl ([77.236.5.166]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 28 Aug 2007 18:01:31 +0200 Received: from jezabek by jezabek.net.autocom.pl with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 28 Aug 2007 18:01:31 +0200 From: Jan Jezabek Date: Tue, 28 Aug 2007 18:00:17 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------080600080204020104000307" Sender: news Subject: [Qemu-devel] [PATCH] Pretend that the floppy is spinning between READ ID requests Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------080600080204020104000307 Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit Hi, 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. Regards, Jan Jezabek --------------080600080204020104000307 Content-Type: text/plain; name="fdc.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="fdc.diff" --- 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); } --------------080600080204020104000307--