* [Qemu-devel] [PATCH] Pretend that the floppy is spinning between READ ID requests
@ 2007-08-28 16:00 Jan Jezabek
0 siblings, 0 replies; only message in thread
From: Jan Jezabek @ 2007-08-28 16:00 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1143 bytes --]
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
[-- Attachment #2: fdc.diff --]
[-- Type: text/plain, Size: 548 bytes --]
--- 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);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-08-28 16:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-28 16:00 [Qemu-devel] [PATCH] Pretend that the floppy is spinning between READ ID requests Jan Jezabek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).