On Mon, Mar 15, 2010 at 02:47:16AM +0000, Jamie Lokier wrote:
Kevin O'Connor wrote:
On my epia-cn, a read of port 0x60 immiediately clears the OBF flag of the status register.
Ok. As in like this, in rapid succession?
inb(0x64) -> OBF is set inb(0x60) -> keyboard byte inb(0x64) -> OBF is clear inb(0x60) -> same keyboard byte
Yes.
That would mean SeaBIOS is broken - and should accept the byte on port 0x60 even if OBF is clear - even on real hardware.
I agree. The latest SeaBIOS git has the needed changes.
The GHOST program which drops/corrupts keys on qemu seems to work fine on my epia-cn.
We'd expect that with any real PC running it's own BIOS. The interesting question is whether it works when running SeaBIOS on real hardware, which is hard to test without suitable hardware :-)
I tested it with coreboot+SeaBIOS (modified to not inspect 0x64) on my epia-cn. I didn't test with the factory BIOS.
As a hack, I suppose qemu could check the time each inb(0x60) and return old data if a new irq hasn't been observed and 660us hasn't elapsed since the first read.
That's no mere hack: it's a good idea. But the 660us would have to be "at least 660us guest time", not qemu clock time.
I don't think it would matter that much in practice. The chance of qemu being preemptively scheduled between two port 0x60 reads is probably very small. These old programs are dropping keys like crazy now - if a fix made them only drop keys sporadically it would still be a big improvement.
That said, I'm not sure there's that much desire to make these old programs work well.
-Kevin