mfld-fr / emu86

Intel IA16 emulator for embedded development
35 stars 6 forks source link

Merge 'next' branch into 'master' #68

Closed mfld-fr closed 3 years ago

mfld-fr commented 3 years ago

While testing this branch on several targets & configurations before merging it into master, I got a regression with the latest ELKS built with emu86-disk.config / EMU86 built with config-elks.mk:

VFS: Unable to open root device 0380

Everything is OK with ELKS built with emu86-rom.config, also with Advantech (MON86 & SYS86) and PC/XT/AT ('8086tiny' floppy image).

ghaerr commented 3 years ago

I got a regression with the latest ELKS built with emu86-disk.config / EMU86 built with config-elks.mk:

Some cleanup changes were made to ELKS yesterday. These changes work under QEMU, but cause EMU86 to fail on last commit to master 80fc8702486ae9144c6a1cbd5845e87052d6c2c7 (No fatal from ROM protection). So it looks like the problem has not to do with merge next to master but before that.

I will look into it and do code review on this merge.

ghaerr commented 3 years ago

Working from last commit to master 80fc8702486ae9144c6a1cbd5845e87052d6c2c7, EMU96 shows BIOS INT 13h result of 0 floppy drives, while QEMU shows 1 floppy drive. So problem is very likely in modified BIOS INT 13h handler from previous commit:

Screen Shot 2021-05-14 at 8 46 52 AM

This is why ELKS can't open root device, as no floppy is present.

ghaerr commented 3 years ago

Review complete, OK to merge. There's quite a lot of changes we've made in the last few days!

I hadn't noticed that MSDOS samples the BIOS timer at boot: why exactly is it we need to emulate the BDA timer?

It seems that the BDA emulation is never ending... we now have BDA initialization in multiple places.

Also, why is timer_enabled turned on initially in timer-elks.c? Just curious.

mfld-fr commented 3 years ago

Thanks for the review and the debug !

MSDOS uses the BIOS timer to timeout and exit from a wait loop early during the boot.

ghaerr commented 3 years ago

Also, why is timer_enabled turned on initially in timer-elks.c? Just curious.

Having the timer turned on initially seems to work for now for ELKS, but I thought it was determined that an early timer interrupt could cause kernel panic. FYI. It was never determined whether the problem was the result of timer frequency only, or whether just that timer was enabled prior to ELKS boot. I realize that BIOS may have initialized timer prior to ELKS boot, thus my continuing confusion on this.

Was this turned on because MSDOS needs it for BIOS timer?

mfld-fr commented 3 years ago

Because the BIOS INT 08h was missing a PUSH AX / POP AX before 58c22f3, it was likely to crash ELKS at any time. Now that the AX register is saved properly, the timer can be started before ELKS boot.

ghaerr commented 3 years ago

Geez, amazing we never saw AX trashing in handler until now. Also somewhat amazing ELKS never crashed from timer interrupt except at early boot.

Good to know ELKS has neither kernel crash problem nor problem with "fast" timers.