qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Re: Qemu floppy emulation problems - partially solved
@ 2004-08-18 15:35 Mike Nordell
  2004-08-31 16:55 ` Derek Fawcus
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Nordell @ 2004-08-18 15:35 UTC (permalink / raw)
  To: qemu-devel

Johannes Martin wrote:

> a little while ago we had some discussion about floppy emulation not
> working in qemu once an OS has been installed. Our assumption was that
> floppy access worked through int13 bios emulation but not really down at
> the hardware level.

Both have problems (errors). Fabrice was (AFAIK) notified by me over one
month ago.

1. diskette_param_table in rombios.c from Bochs is too short. It neeed two
more bytes, else e.g. NT believes the floppy only got 31 cylinders (the code
following the table begins with "push ds", 0x1e, and that just happens to be
"maximum track" NT expects). Append:
db 79
db 0

This is obvious if looking at the registry value
HKLM\HARDWARE\DESCRIPTION\System\MultifunctionAdapter\x\DiskController\y\Flo
ppyDiskPeripheral\0\Configuration Data.

(x, y was 5 and 0 respectively on a real machine, but you might experience
local fluctuations)

Compare the last two bytes from a real system (working) with a non-working
QEMU-installed system.

2. fdc.c has got some problems:
2.1 fdctrl_stop_transfer:
- fdctrl->fifo[0] = status0 | (cur_drv->head << 1) | fdctrl->cur_drv;
+ fdctrl->fifo[0] = status0 | (cur_drv->head << 2) | fdctrl->cur_drv;

2.2 fdctrl_write_data for case 0x08 /* SENSE_INTERRUPT_STATUS*/:
- fdctrl->fifo[0] =
    fdctrl->int_status | (cur_drv->head << 2) | fdctrl->cur_drv;
+ fdctrl->fifo[0] = 0x20 /* seek complete */ | (cur_drv->head << 2) |
fdctrl->cur_drv;

To be 100% clear about 2.2, it is AFAIK _not_ to return the main status
register like it was/is.

2.3 Just for good measure, let's tell the OS we got a two-sided drive. For
case SENSE_DRIVE_STATUS transfer, just before "fdctrl_set_fifo(fdctrl, 1,
0);" I put:
+ fdctrl->fifo[0] |= 0x08; // two-sided drive

2.4 And finally while treating READ_ID:
+ cur_drv->head = (fdctrl->fifo[1] >> 2) & 1;


As I haven't got the tools to rebuild the rombios, I can't verify that fix.
The other hardware-emulation fixes are AFAIK 100% correct.


/Mike

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [Qemu-devel] Re: Qemu floppy emulation problems - partially solved
@ 2004-10-07 13:37 Mike Nordell
  2004-10-07 17:13 ` Derek Fawcus
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Nordell @ 2004-10-07 13:37 UTC (permalink / raw)
  To: qemu-devel

Derek Fawcus wrote:

> Well I was waiting to here back if the change I proposed had
> any positive effects,  since I'm not experiencing the problems
> it's supposed to address.
>
> However I've had no feedback,  so it's a bit difficult to tell
> if it's of help.

Sorry for the delay.

Let me first bring some good news: As of 15 hours ago, I fixed the final bug
of the hardware emulation part of the floppy that prevented it working
for/with NT5+ (Windows 2000 and later) guests. It's not in CVS as of this
writing, but I suspect it'll be shortly.

Now for the software problem, I'm sorry to say your patch didn't help. With
your patch (as applied and compiled in the bios binary image in CVS), NT
still believes the floppy only got 31 cylinders.

I have verified that direct modification of a BIOS image, appending the
max.cyl. and a zero to the originally placed diskette_param_table does make
NT work as expected re. floppy, in that it recognizes it as having 80
cylinders instead of the 31 cylinders it otherwise believes due to the
binary representation of the following "push ds". Obviously that overwrites
the leading two bytes of the int 17h handler, so while it makes NT floppy
handling work it breaks DOS - I couldn't even boot a DOS image with such a
modified BIOS image. Not good.

As the source code for NT isn't available, there is no way of really knowing
how, and where from NT grabs this data. I haven't (yet) checked with a real
BIOS to see if it too obeys the hard-coded offset efd2 for int 17h (which
here is the limiting factor for the diskette_param_table), but if it does NT
obviously must assemble this information from some other place since it
works on real h/w.

Could it be that this information, using a real BIOS, is first copied down
to the BIOS playground area (0040:xxxx), appends the extra knowledge (i.e.
maxtrack = 79) and then it points the 1e interrupt vector to this new place?

I think what's needed is an authorative answer from someone that really
knows either how a real BIOS behaves or how NT does this discovery in
detail, or close examination and/or empirical evidence from a real BIOS.

/Mike

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [Qemu-devel] Re: Qemu floppy emulation problems - partially solved
@ 2004-10-08  9:39 Mike Nordell
  0 siblings, 0 replies; 7+ messages in thread
From: Mike Nordell @ 2004-10-08  9:39 UTC (permalink / raw)
  To: qemu-devel

Derek Fawcus wrote:

> So does it make any difference if you use the BIOS image I
> posted,  or does that also fail to help?

With CVS BIOS as of now, it seems to work both on the hardware and software
side. 80 cylinders reported, access works. Unless anything else turns up, I
think this can be considered closed.

--
/Mike

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-10-08  9:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-18 15:35 [Qemu-devel] Re: Qemu floppy emulation problems - partially solved Mike Nordell
2004-08-31 16:55 ` Derek Fawcus
2004-10-03 21:49   ` Fabrice Bellard
2004-10-04 22:00     ` Derek Fawcus
  -- strict thread matches above, loose matches on Subject: below --
2004-10-07 13:37 Mike Nordell
2004-10-07 17:13 ` Derek Fawcus
2004-10-08  9:39 Mike Nordell

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).