[SeaBIOS] Bochs cvs + SeaBIOS git master + FreeDOS = slow load + invalid opcode
Sebastian Herbszt
herbszt at gmx.de
Mon Jan 11 22:28:49 CET 2010
Kevin O'Connor wrote:
> On Sun, Jan 10, 2010 at 11:46:50PM +0100, Sebastian Herbszt wrote:
>> Kevin O'Connor wrote:
>> >05264161428i[FDD ] controller reset in software
>> >05445136148i[FDD ] controller reset in software
>> >05625186768i[FDD ] controller reset in software
>> >05803824012i[FDD ] controller reset in software
>> >05985259728i[FDD ] controller reset in software
>> >
>> >SeaBIOS makes a call to wait_irq() in the wait_floppy_irq() function
>> >in src/floppy.c. My guess is that the floppy irq was lost, and
>> >SeaBIOS went into recovery mode. It's just a guess, but maybe
>> >0x00020f41 isn't populated because the floppy read failed (because of
>> >lost irq?).
>>
>> It is indeed related to floppy. Booting FreeDOS from cd works.
>
> Yeah - this patch also fixes the problem:
>
> --- a/src/floppy.c
> +++ b/src/floppy.c
> @@ -182,7 +182,8 @@ wait_floppy_irq(void)
> v = GET_BDA(floppy_recalibration_status);
> if (v & FRS_TIMEOUT)
> break;
> - wait_irq();
> + //wait_irq();
> + yield();
> }
>
> v &= ~FRS_TIMEOUT;
>
> I still don't think it should be necessary though. Maybe Bochs is
> dropping floppy irqs when halted?
The problem occurs on
COMMAND: [e6] [04] [03] [01] [01] [02] [12] [00] [ff]
Debug output with Bochs BIOS
00131978879d[FDD ] read/write normal data
00131978879d[FDD ] BEFORE
00131978879d[FDD ] drive = 0
00131978879d[FDD ] head = 1
00131978879d[FDD ] cylinder = 3
00131978879d[FDD ] sector = 1
00131978879d[FDD ] eot = 18
00131978879d[FDD ] read!
00131978879d[FDD ] floppy_xfer: drive=0, offset=64512, bytes=512, direction=from floppy
00131978879d[FDD ] io_write: diskette controller data
00132201610d[FDD ] floppy_xfer: drive=0, offset=65024, bytes=512, direction=from floppy
00132424341d[FDD ] floppy_xfer: drive=0, offset=65536, bytes=512, direction=from floppy
00132647072d[FDD ] floppy_xfer: drive=0, offset=66048, bytes=512, direction=from floppy
00132869803d[FDD ] floppy_xfer: drive=0, offset=66560, bytes=512, direction=from floppy
00133092534d[FDD ] floppy_xfer: drive=0, offset=67072, bytes=512, direction=from floppy
00133315265d[FDD ] floppy_xfer: drive=0, offset=67584, bytes=512, direction=from floppy
00133537996d[FDD ] floppy_xfer: drive=0, offset=68096, bytes=512, direction=from floppy
00133760727d[FDD ] floppy_xfer: drive=0, offset=68608, bytes=512, direction=from floppy
00133983458d[FDD ] floppy_xfer: drive=0, offset=69120, bytes=512, direction=from floppy
00134206189d[FDD ] floppy_xfer: drive=0, offset=69632, bytes=512, direction=from floppy
00134428920d[FDD ] floppy_xfer: drive=0, offset=70144, bytes=512, direction=from floppy
00134651651d[FDD ] floppy_xfer: drive=0, offset=70656, bytes=512, direction=from floppy
00134874382d[FDD ] floppy_xfer: drive=0, offset=71168, bytes=512, direction=from floppy
00135097113d[FDD ] floppy_xfer: drive=0, offset=71680, bytes=512, direction=from floppy
00135319844d[FDD ] floppy_xfer: drive=0, offset=72192, bytes=512, direction=from floppy
00135542575d[FDD ] floppy_xfer: drive=0, offset=72704, bytes=512, direction=from floppy
00135765306d[FDD ] floppy_xfer: drive=0, offset=73216, bytes=512, direction=from floppy
00135988037d[FDD ] <<READ DONE>>
00135988037d[FDD ] AFTER
00135988037d[FDD ] drive = 0
00135988037d[FDD ] head = 0
00135988037d[FDD ] cylinder = 4
00135988037d[FDD ] sector = 1
00135988037d[FDD ] raise_interrupt
00135988037d[FDD ] RESULT: [00] [00] [00] [04] [00] [01] [02]
18 sectors read and INT raised
Debug output with SeaBIOS
01484895591d[FDD ] read/write normal data
01484895591d[FDD ] BEFORE
01484895591d[FDD ] drive = 0
01484895591d[FDD ] head = 1
01484895591d[FDD ] cylinder = 3
01484895591d[FDD ] sector = 1
01484895591d[FDD ] eot = 18
01484895591d[FDD ] read!
01484895591d[FDD ] floppy_xfer: drive=0, offset=64512, bytes=512, direction=from floppy
01484895591d[FDD ] io_write: diskette controller data
01484895738i[BIOS ] wait_floppy_irq
01484895804i[BIOS ] loop
01489702451i[BIOS ] loop
01494447511i[BIOS ] loop
01499057671i[BIOS ] loop
01499057689d[FDD ] floppy_xfer: drive=0, offset=65024, bytes=512, direction=from floppy
01502531391i[BIOS ] loop
01507211711i[BIOS ] loop
01512251591i[BIOS ] loop
01512251609d[FDD ] floppy_xfer: drive=0, offset=65536, bytes=512, direction=from floppy
01516144951i[BIOS ] loop
01520033811i[BIOS ] loop
01525074171i[BIOS ] loop
01525074189d[FDD ] floppy_xfer: drive=0, offset=66048, bytes=512, direction=from floppy
01529576831i[BIOS ] loop
01533488331i[BIOS ] loop
01537715651i[BIOS ] loop
01537715669d[FDD ] floppy_xfer: drive=0, offset=66560, bytes=512, direction=from floppy
01542568211i[BIOS ] loop
01546724771i[BIOS ] loop
01550561771i[BIOS ] loop
01550561789d[FDD ] floppy_xfer: drive=0, offset=67072, bytes=512, direction=from floppy
01555519611i[BIOS ] loop
01560268911i[BIOS ] loop
01563912291i[BIOS ] loop
01563912309d[FDD ] floppy_xfer: drive=0, offset=67584, bytes=512, direction=from floppy
01568386751i[BIOS ] loop
01573060051i[BIOS ] loop
01578036231i[BIOS ] loop
01578036249d[FDD ] floppy_xfer: drive=0, offset=68096, bytes=512, direction=from floppy
01580926271i[BIOS ] loop
01585943311i[BIOS ] loop
01590928071i[BIOS ] loop
01590928089d[FDD ] floppy_xfer: drive=0, offset=68608, bytes=512, direction=from floppy
01595412451i[BIOS ] loop
01598790831i[BIOS ] loop
01603770011i[BIOS ] loop
01603770029d[FDD ] floppy_xfer: drive=0, offset=69120, bytes=512, direction=from floppy
01608437351i[BIOS ] loop
01612548071i[BIOS ] loop
01616476651i[BIOS ] loop
01616476669d[FDD ] floppy_xfer: drive=0, offset=69632, bytes=512, direction=from floppy
01621418291i[BIOS ] loop
01626062131i[BIOS ] loop
01629802031i[BIOS ] loop
01629802049d[FDD ] floppy_xfer: drive=0, offset=70144, bytes=512, direction=from floppy
01634074311i[BIOS ] loop
01638668771i[BIOS ] loop
01643752491i[BIOS ] loop
01643752509d[FDD ] floppy_xfer: drive=0, offset=70656, bytes=512, direction=from floppy
01646422786d[FDD ] read(): during command 0xe6, port 0x03f2 returns 0x1c
01646422788d[FDD ] write access to port 0x03f2, value=0x0c
01646422788d[FDD ] io_write: digital output register
01646422788d[FDD ] motor on, drive1 = 0
01646422788d[FDD ] motor on, drive0 = 0
01646422788d[FDD ] dma_and_interrupt_enable=08
01646422788d[FDD ] normal_operation=04
01646422788d[FDD ] drive_select=00
01646422895i[BIOS ] loop
01646423091i[BIOS ] floppy_motor_counter
01646423116d[FDD ] read(): during command 0xe6, port 0x03f2 returns 0x0c
01646423120d[FDD ] write access to port 0x03f2, value=0x08
01646423120d[FDD ] io_write: digital output register
01646423120d[FDD ] motor on, drive1 = 0
01646423120d[FDD ] motor on, drive0 = 0
01646423120d[FDD ] dma_and_interrupt_enable=08
01646423120d[FDD ] normal_operation=00
01646423120d[FDD ] drive_select=00
01646423123d[FDD ] write access to port 0x03f2, value=0x0c
01646423123d[FDD ] io_write: digital output register
01646423123d[FDD ] motor on, drive1 = 0
01646423123d[FDD ] motor on, drive0 = 0
01646423123d[FDD ] dma_and_interrupt_enable=08
01646423123d[FDD ] normal_operation=04
01646423123d[FDD ] drive_select=00
01646423125d[FDD ] read(): during command 0xfe, port 0x03f4 returns 0x00
wait_floppy_irq() gets called, for () loop, 13 sectors read, wait_floppy_irq() returns with -1.
So we have
01616476651i[BIOS ] loop
01616476669d[FDD ] floppy_xfer: drive=0, offset=69632, bytes=512, direction=from floppy <- normal transfer
01621418291i[BIOS ] loop
01626062131i[BIOS ] loop
01629802031i[BIOS ] loop
01629802049d[FDD ] floppy_xfer: drive=0, offset=70144, bytes=512, direction=from floppy <- normal transfer
01634074311i[BIOS ] loop
01638668771i[BIOS ] loop
01643752491i[BIOS ] loop
01643752509d[FDD ] floppy_xfer: drive=0, offset=70656, bytes=512, direction=from floppy <- normal transfer
01646422786d[FDD ] read(): during command 0xe6, port 0x03f2 returns 0x1c <- INT 08h calls floppy_tick()
01646422788d[FDD ] write access to port 0x03f2, value=0x0c
01646422788d[FDD ] io_write: digital output register
01646422788d[FDD ] motor on, drive1 = 0
01646422788d[FDD ] motor on, drive0 = 0
01646422788d[FDD ] dma_and_interrupt_enable=08
01646422788d[FDD ] normal_operation=04
01646422788d[FDD ] drive_select=00
01646422895i[BIOS ] loop <- wait_floppy_irq() for() loop continues...
01646423091i[BIOS ] floppy_motor_counter <- ... and exits
- Sebastian
More information about the SeaBIOS
mailing list