From patchwork Thu Mar 11 07:42:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Tam X-Patchwork-Id: 47302 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 92045B7D48 for ; Thu, 11 Mar 2010 18:52:11 +1100 (EST) Received: from localhost ([127.0.0.1]:52993 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Npd4f-0003Jf-JZ for incoming@patchwork.ozlabs.org; Thu, 11 Mar 2010 02:44:53 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Npd2o-0003DE-ET for qemu-devel@nongnu.org; Thu, 11 Mar 2010 02:42:58 -0500 Received: from [199.232.76.173] (port=37756 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Npd2m-0003Cd-G8 for qemu-devel@nongnu.org; Thu, 11 Mar 2010 02:42:56 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Npd2k-0007pg-V9 for qemu-devel@nongnu.org; Thu, 11 Mar 2010 02:42:56 -0500 Received: from mx20.gnu.org ([199.232.41.8]:32670) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Npd2k-0007pY-Be for qemu-devel@nongnu.org; Thu, 11 Mar 2010 02:42:54 -0500 Received: from mail-pz0-f194.google.com ([209.85.222.194]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Npd2h-0008Re-OH for qemu-devel@nongnu.org; Thu, 11 Mar 2010 02:42:51 -0500 Received: by pzk32 with SMTP id 32so502374pzk.4 for ; Wed, 10 Mar 2010 23:42:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:cc:content-type; bh=t77goU7lB3gAvTxUVyVDfWevb5f+W80T5I6FREi2aNM=; b=mhmN8Ni/rXsZSOpqzfFxldSirxklY7RqiS3yPlgjomcVewWVCCg//5dE+ZJYJDh3Aw NV8lueGtZWf3DME+dnDbfv1YH7l5WarbqydM0Wtg/0Ejbc/eFNyrf4eAf/D8dcSqgox/ MNVRdbXKkuLauweLY4dWUEPcUY0Ip0tgcwzdk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=kIeqEBFtqE4poooHiQ6ucy1wtaUjlE053scquyy2ot17zcjdw8guiFz/26+6SMVAO1 3fQSAxaUt4eEzxWQHfWbbsJ/yb3ujtcv6c4MpK7c5dDdoasnW/DzRxZ3BhDS585aP+Zk Gh4XJg/EqX4nyctQC/8zVuLXxbbkSzqMUMMtA= MIME-Version: 1.0 Received: by 10.114.6.7 with SMTP id 7mr1192927waf.90.1268293368266; Wed, 10 Mar 2010 23:42:48 -0800 (PST) In-Reply-To: <20100311030742.GA26752@morn.localdomain> References: <473191351003071804x62acae0bk3f967b6be1f22a54@mail.gmail.com> <20100310021220.GB29054@morn.localdomain> <473191351003091949j6f3fbf98jadc87405876db214@mail.gmail.com> <20100310045942.GC29054@morn.localdomain> <473191351003092124o382bddc8m80df4676c048ec0a@mail.gmail.com> <20100311030742.GA26752@morn.localdomain> From: Roy Tam Date: Thu, 11 Mar 2010 15:42:28 +0800 Message-ID: <473191351003102342x1f25f281l77a3b325726a602c@mail.gmail.com> Subject: Re: [Qemu-devel] Regression: more 0.12 regression (SeaBIOS related?) To: "Kevin O'Connor" X-detected-operating-system: by mx20.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: seabios@seabios.org, qemu-devel X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 2010/3/11 Kevin O'Connor : > On Wed, Mar 10, 2010 at 01:24:27PM +0800, Roy Tam wrote: >> 2010/3/10 Kevin O'Connor : >> > I don't see an "Illegal Instruction" message. Instead, I see the >> > keyboard just not working. What qemu version and what command line >> > did you use? >> >> latest git today. when you type fast. > > Bleh. That image defines an int15 wrapper which corrupts %edi. > SeaBIOS calls int154f from the keyboard irq, and it is not prepared to > handle a corrupted edi. In contrast, Bochs BIOS doesn't care if the > registers change. > >> > What the fdos0138.img image is doing is broken - once it reads the key >> > from the ps2 port, nothing stops a new key from being read the next >> > time something reads from the port. Indeed, although the keyboard >> > works in qemu-0.11 for fdos0138.img, if one types fast they'll see >> > duplicate and lost keys. >> > >> >> But it is how programs(Chinese/Japanese/Korean Display Systems, >> GW-BASIC, etc.) in the past get input from keyboard. > > Can you point me to documentation on this usage? > Sorry I can't find documentation on this usage. But instead I have lots of old programs written with this usage. Using undocumented features from BIOS/DOS is very usual in that time. >> "Consider" legacy as "broken" is wrong IMHO. > > It's broken because it causes key presses to be lost and corrupted. > The ps2 port hardware just doesn't work the way that software is > trying to use it. > You said that "it causes key presses to be lost and corrupted" but I haven't heard any complain about this. Real BIOSes (Award BIOS, AMI BIOS, Phoenix BIOS) handle this usage very well and no key press are lost or corrupted. Any key press should generate 4 IRQs, for example when I press [Tab] key, it should have IRQs like this: ps2: data f (status=1d) ps2: data f (status=1c) ps2: data 8f (status=1d) ps2: data 8f (status=1c) Even if status&1==1 is handled by the program itself, status==0x1c is still handled by BIOS. Programs in the past will try to get data from BIOS in this moment to ensure two scancodes are the same. On the contrary *NOT* sending keycode in this moment cause bigger problem. The following patch help people to see irq status and data change: diff --git a/src/ps2port.c b/src/ps2port.c index 49bf551..48d940f 100644 --- a/src/ps2port.c +++ b/src/ps2port.c @@ -154,11 +154,19 @@ process_ps2byte(u8 status, u8 data) static void process_ps2bytes(void) { + u8 status = 0; + u8 data = 0; + u8 old_status = 0; + u8 old_data = 0; for (;;) { - u8 status = inb(PORT_PS2_STATUS); + old_status = status; + old_data = data; + status = inb(PORT_PS2_STATUS); + data = inb(PORT_PS2_DATA); + if ((data != old_data)||(status!=old_status)) + dprintf(1, "ps2: data %x (status=%x)\n", data, status); if (!(status & I8042_STR_OBF)) return; - u8 data = inb(PORT_PS2_DATA); process_ps2byte(status, data); } }