[SeaBIOS] [PATCH 2/2] floppy: Clear the IRQ flag immediately before a floppy command or reset

Kevin O'Connor kevin at koconnor.net
Mon Feb 26 22:13:01 CET 2018


On Mon, Feb 26, 2018 at 11:05:29PM +0200, Nikolay Nikolov wrote:
> On Sun, 2018-02-25 at 18:33 -0500, Kevin O'Connor wrote:
> > On Sun, Feb 25, 2018 at 10:38:09PM +0200, Nikolay Nikolov wrote:
> > > This ensures that we safely receive the IRQ even if the floppy
> > > controller
> > > manages to be faster than our code and sends the IRQ before our
> > > code enters
> > > floppy_wait_irq(). Although unlikely, this is possible to happen on
> > > emulators
> > > (which emulate floppy operations extremely fast) as well as real
> > > hardware
> > > (during reset).
> > 
> > This doesn't look correct to me.  The SeaBIOS C code always runs with
> > interrupts disabled.  The FRS_IRQ flag is only set from the
> > handle_0e() hardware interrupt handler.  So, I don't think there is a
> > race condition with the clearing and checking of that flag.
> 
> Sorry, I didn't know that the SeaBIOS C code runs with interrupts
> disabled. I assumed they were enabled. Please disregard this patch.

No problem.  Be aware that yield() or anything that calls yield()
(such as sleep() ) will allow irqs to occur.  There's some
documentation on this in docs/Execution_and_code_flow.md.

-Kevin



More information about the SeaBIOS mailing list