[Patch] Floppy emulation on old Linux kernels
Posted: Wed 24 Jan, 2018 8:29 am
Hi guys,
I noticed some time ago, that some old versions of the Linux kernel freeze in floppy drive detection.
I know that these kernels run fine on older versions of PCem, so I tried to locate the exact change in the PCem code which causes this bug.
These old Linux kernels started to freeze after this change in fdc.c:
https://bitbucket.org/pcem_emulator/pce ... at=default
To know whats going on, I enabled some of the pclog lines in fdc.c and I got this:
The last 6 lines are repeating over and over, so it seems like the kernel is stuck in an endless loop.
After reverting the change in fdc.c, the kernel boots again. I don't know why this change causes this behavior since the code seems to be equal.
Anyways, I attached a patch. After this patch, these old kernels are no longer stuck in the floppy drive detection and boot successfully again.
Edit:
The code is not equal, if fdc_reset_stat is 1.
I noticed some time ago, that some old versions of the Linux kernel freeze in floppy drive detection.
I know that these kernels run fine on older versions of PCem, so I tried to locate the exact change in the PCem code which causes this bug.
These old Linux kernels started to freeze after this change in fdc.c:
https://bitbucket.org/pcem_emulator/pce ... at=default
To know whats going on, I enabled some of the pclog lines in fdc.c and I got this:
Code: Select all
Write FDC 03F2 04 C000000: 24864983 00 24864983 rate=0 0
Write FDC 03F2 0C C000000: 24865044 00 24865044 rate=0 0
Write FDC 03F2 0C C000000: 24865233 00 24865233 rate=0 0
Write FDC 03F2 08 C000000: 24865996 00 24865996 rate=0 0
Write FDC 03F2 0C C000000: 24866016 00 24866016 rate=0 0
Reset FDC
fdc_callback -1 0
Write FDC 03F5 08 C000000: 24866231 00 24866231 rate=0 0
Starting FDC command 08
fdc_callback 8 0
Sense interrupt status 4
Read param 9 C0
Read param 10 1B
Write FDC 03F5 08 C000000: 24866392 00 24866392 rate=0 0
Starting FDC command 08
fdc_callback 8 0
Sense interrupt status 3
Read param 9 C1
Read param 10 1B
Write FDC 03F5 08 C000000: 24866459 00 24866459 rate=0 0
Starting FDC command 08
fdc_callback 8 0
Sense interrupt status 2
Read param 9 C2
Read param 10 1B
Write FDC 03F5 08 C000000: 24866488 00 24866488 rate=0 0
Starting FDC command 08
fdc_callback 8 0
Sense interrupt status 1
Read param 9 C3
Read param 10 1B
Write FDC 03F5 08 C000000: 24866503 80 24866503 rate=0 0
Starting FDC command 08
fdc_callback 8 0
Sense interrupt status 0
Read param 9 80
Read param 10 1B
Write FDC 03F5 08 C000000: 24866503 80 24866503 rate=0 0
Starting FDC command 08
fdc_callback 8 0
Sense interrupt status 0
Read param 9 80
Read param 10 1B
Write FDC 03F5 08 C000000: 24866503 80 24866503 rate=0 0
Starting FDC command 08
fdc_callback 8 0
Sense interrupt status 0
Read param 9 80
Read param 10 1B
After reverting the change in fdc.c, the kernel boots again. I don't know why this change causes this behavior since the code seems to be equal.
Anyways, I attached a patch. After this patch, these old kernels are no longer stuck in the floppy drive detection and boot successfully again.
Edit:
The code is not equal, if fdc_reset_stat is 1.