mirror of
https://github.com/RhapsodiOS/RhapsodiOS.git
synced 2026-11-03 22:01:40 -07:00
[GH-ISSUE #50] drvPCFloppy: rebuilt driver fails to reserve IRQ 6, FloppyController never configures #45
Labels
No labels
bug
documentation
enhancement
enhancement
good first issue
help wanted
help wanted
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github-starred/RhapsodiOS#45
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @raynorpat on GitHub (Oct 14, 2026).
Original GitHub issue: https://github.com/RhapsodiOS/RhapsodiOS/issues/50
The in-tree
src/drivers-i386/ide/drvPCFloppydriver builds, but at boot its controller fails to configure:Apple's 1998 binary (
PROGRAM:Floppy PROJECT:drvPCFloppy-5, built Sat Mar 28 1998), which ships onrhap-i386-bootstrapped-v2.img, registers the controller (Registering: fc0) at the same point in the same boot.The kernel is not the cause. The failing boot used master's kernel (pre-clamp
952b547de) with v2's own boot2 and sarld; the only change was swapping in the rebuiltFloppy.config(Floppy_relocandDefault.table). v2'sInstance0.tablewas kept, apart from one added"Kernel ABI"key that this kernel does not read. The same failure also appears with the flat kernel from branchi386-flat.Where it fails. The message comes from
-[KernDeviceDescription _parseItemResourceByKey:value:](src/kernel-7/driverkit/KernDeviceDescription.m:631), whenreserveItem:for IRQ 6 returns nil. Something holds IRQ 6 before the controller's table resources are reserved, and that happens only with the rebuilt driver loaded.One difference worth checking. The rebuilt
Default.tablehas a key with no value,"Boot Driver";, where Apple's table has"Boot Driver" = "Boot Driver";. The boot used v2'sInstance0.table, though, so this may be unrelated.To reproduce:
-M pc -cpu pentium -m 768, on a throwaway copy ofvm/work/rhap-i386-bootstrapped-v2.img(-snapshot), with Kernel Flags-v -s.rbuild buildpackage --toolchain gcc-darwin-i386.conf --arch i386, and replace/private/Drivers/i386/Floppy.config/Floppy_relocandDefault.tableon the copy with the rebuilt ones.Found 2026-10-14 while boot-testing the i386 flat kernel. It also blocks that plan's ISA DMA check, which reads from the floppy.
@raynorpat commented on GitHub (Oct 14, 2026):
Fixed. The IRQ 6 failure was the first of several bugs, found by booting the rebuilt driver for the first time and comparing it with Apple's 1998 binary on the same guest.
Cause of this issue:
+[IODiskPartitionNEW deviceStyle]returnedIO_DirectDevice(0). Apple's returns 1 (IO_IndirectDevice).IODiskPartitionNEWcomes beforeFloppyControllerinClass Names, soconfigureDriverreserved the table's DMA, IRQ and ports for it first. The"Boot Driver";key was unrelated: Apple's table has the same line.Further defects fixed, in the order the guest hit them:
FloppyControllerivar layout was off by 4 from 0x12c, and the six_dataRateChangeCount++lines wereoutb()'s ownlock incl, not driver code.sendCmd:reported every result-less command as failed (so the controller never initialised); RECALIBRATE/SEEK read the wrong result bytes.getDriveStatus:read write-protect from the wrong field, so every disk looked write-protected.attachBsdDiskInterfaceToDrive:andfdRwCommon:sent selectors no class implements (kernel panic on first access).constructRequest:treated the write flag as a pointer: writes ran as reads and stored to address 1._probeLabel:truncated the label pointer to aBOOL, so/dev/rfd0a(newfs/fsck) was unusable.fdrToIo, the read/write entry points andupdatePhysicalParametersIntreturned the wrong codes.IOFloppyDriveshadowedIODriveNEW's_diskId, so no disk inserted after an eject was ever probed.Verified on a QEMU
-M pcguest ofrhap-i386-bootstrapped-v2.img, against Apple's driver:disk -i,newfs,mount, copy,fsck, read-back after remount;disk -e, and write-protected media refused withPermission denied.Not tested:
fdform, a second drive, 720 KB / 2.88 MB media, real hardware.Commits (on local master, not yet pushed):
88a9ee7e6,36de697b4,9582d6591,6dc322263. The last one adds a section on this test toreconstruction/divergences.md.