qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin O'Connor <kevin@koconnor.net>
To: Jamie Lokier <jamie@shareable.org>
Cc: seabios@seabios.org, qemu-devel <qemu-devel@nongnu.org>,
	Roy Tam <roytam@gmail.com>
Subject: [Qemu-devel] Re: PC keyboard emulation (was: Regression: more 0.12 regression (SeaBIOS related?))
Date: Sat, 13 Mar 2010 19:44:19 -0500	[thread overview]
Message-ID: <20100314004419.GA11285@morn.localdomain> (raw)
In-Reply-To: <20100312232427.GF6491@shareable.org>

On Fri, Mar 12, 2010 at 11:24:27PM +0000, Jamie Lokier wrote:
> The DOS coding method brought up in this thread, resulting
> in two reads of port 0x60, is quite common.  It works on all real PCs,
> and correct emulation must handle it.
> 
> I'm not sure if reading port 0x60 is supposed to clear the status bit
> immediately or not.  The problem might be QEMU's hardware emulation
> clearing the 8042 status bit too quickly, or it might be SeaBIOS
> should not check the status bit - in which case it probably fails on
> _real_ hardware too, when running these old DOS TSRs and similar
> programs.
> 
> It would be good if someone can check the behaviour of real hardware.

On my epia-cn, a read of port 0x60 immiediately clears the OBF flag of
the status register.

The GHOST program which drops/corrupts keys on qemu seems to work fine
on my epia-cn.

[...]
> In other words, 8042 emulation _should_ permit port 0x60 to be read
> multiple times, but if sufficient time elapses without the irq being
> acknowledged, it should drop the byte and deliver the next one.

The ps2 port can use up to a 16.6Khz clock, and it takes 11 clock
cycles to read a byte.  The next keyboard byte only starts being
transmitted after the first byte is dequeued, so a second read of the
data port shouldn't return a new byte in less than 660us.

However, I don't see anything that would prevent a mouse data byte
being read on the second read.  So, this still seems very sloppy to
me.

> Unfortunately, in QEMU _guaranteeing_ that the guest has had some
> guest time to process the irq before the timeout is a bit tricky, if
> QEMU is delayed by host scheduling.

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.

-Kevin

  reply	other threads:[~2010-03-14  0:44 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-08  2:04 [Qemu-devel] Regression: more 0.12 regression (SeaBIOS related?) Roy Tam
2010-03-08 10:05 ` Jamie Lokier
2010-03-08 11:08   ` Roy Tam
2010-03-08 13:48     ` Roy Tam
2010-03-10  4:48       ` Roy Tam
2010-03-09 15:41 ` Natalia Portillo
2010-03-09 16:09   ` Natalia Portillo
2010-03-10  2:12 ` Kevin O'Connor
2010-03-10  3:49   ` Roy Tam
2010-03-10  4:59     ` Kevin O'Connor
2010-03-10  5:05       ` Roy Tam
2010-03-10  5:55         ` Kevin O'Connor
2010-03-10  5:24       ` Roy Tam
2010-03-11  3:07         ` Kevin O'Connor
2010-03-11  7:42           ` Roy Tam
2010-03-11  8:10             ` Natalia Portillo
2010-03-12  0:57             ` Kevin O'Connor
2010-03-12  1:17               ` Roy Tam
2010-03-12 16:13               ` Roy Tam
2010-03-13 15:35                 ` Kevin O'Connor
2010-03-13 16:00                   ` Roy Tam
2010-03-12 23:24               ` [Qemu-devel] PC keyboard emulation (was: Regression: more 0.12 regression (SeaBIOS related?)) Jamie Lokier
2010-03-14  0:44                 ` Kevin O'Connor [this message]
2010-03-15  2:47                   ` [Qemu-devel] " Jamie Lokier
2010-03-15  3:08                     ` Kevin O'Connor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100314004419.GA11285@morn.localdomain \
    --to=kevin@koconnor.net \
    --cc=jamie@shareable.org \
    --cc=qemu-devel@nongnu.org \
    --cc=roytam@gmail.com \
    --cc=seabios@seabios.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).