On Mon 22 Jun 2020 at 10:58, Gerd Hoffmann <kra...@redhat.com> wrote:
On Sat, Jun 20, 2020 at 10:12:51PM +0300, Mike Banon wrote:
> Well, I suspect for these use cases it'll be *alot* easier to add emulated harddisk support instead.

 It requires coding for SeaBIOS

Same is true for superfloppy support.  And testing this is much more
difficult.  Physical floppies are pretty much dead these days, and I
doubt qemu can properly emulate all those tricks which superfloppy
formats are using.

That much is true: QEMU only supports logically-addressed disk images with a uniform sector size (and probably only 512-byte sectors, I have not checked thoroughly). The floppy controller emulation code looks at the size of the disk image and tries to match it against a table of known geometries I linked in my first message; a matched geometry is then presented to the guest – as in, if the guest assumes that geometry when accessing the drive, the accesses will be dispatched to the expected logical sectors of the image. Some of those known geometries correspond to superformats.

Meanwhile in the guest, SeaBIOS does the same thing in reverse: when the floppy driver is initialised, a fixed geometry is assigned to each floppy drive[0], which is later used to validate CHS addresses and convert them into LBA[1], before dispatching the access to the floppy driver which converts LBA back into CHS when communicating with the hardware[2]. Not only is this back-and-forth rather silly, it causes problems when the geometry of the actual diskette in the drive does not match this made-up logical geometry, like when a virtual 23 × 80 × 2 disk image appears in a 1440 KiB drive (which SeaBIOS thinks should only ever deal with 18 × 80 × 2 disks).

[0]: https://git.seabios.org/cgit/seabios.git/tree/src/hw/floppy.c?h=af0daeb2687ad2595482b8a71b02a082a5672ceb#n109 [1]: https://git.seabios.org/cgit/seabios.git/tree/src/disk.c?h=af0daeb2687ad2595482b8a71b02a082a5672ceb#n138 [2]: https://git.seabios.org/cgit/seabios.git/tree/src/hw/floppy.c?h=af0daeb2687ad2595482b8a71b02a082a5672ceb#n571

Also: why invest much effort to squeeze a limited amount of additional
capacity out of floppies if you can effectively remove all your capacity
issues by just using hd images instead?

In my case, the effort wasn’t all that big; all I did was patch SeaBIOS not to convert CHS addresses to LBA and back when accessing floppy drives. Less than a 100 lines of code were changed. It’s a pretty dirty hack though, and you probably won’t take it, so I wrote this report to put the issue on the record so that it can be fixed properly. I realise supporting superformats on bare hardware would be much more effort and I’m not demanding it done immediately, but it’s probably worth having on the record too.

And the reason I want to have large floppy images is that I want to use hard disk images for something else.

Regards,
—f

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-le...@seabios.org

Reply via email to