*BSD News Article 2517


Return to BSD News archive

Path: sserve!manuel!munnari.oz.au!mips!mips!swrinde!news.dell.com!raid.dell.com!james
From: james@raid.dell.com (James Van Artsdalen)
Newsgroups: comp.unix.bsd
Subject: 386BSD 0.1: pccons.c bug
Message-ID: <1992Jul26.061759.13547@raid.dell.com>
Date: 26 Jul 92 06:17:59 GMT
Sender: james@raid.dell.com (James Van Artsdalen)
Reply-To: james@raid.dell.com (James Van Artsdalen)
Organization: Dell Computer Corporation
Lines: 35

I think there is a bug in the function kbd_cmd in pccons.c.

kbd_cmd waits for the 8042 input buffer to empty, and then writes a
byte destined for the keyboard.

kbd_cmd then waits for the 8042 input buffer to become empty again,
and then reads the output buffer.  This part is wrong: kbd_cmd should
wait for the output buffer to become full, rather than wait for the
input buffer to become empty.

I haven't tested this change.  I found the bug by inspection.

*** pccons.c.~1~	Sun Jul 26 01:12:26 1992
--- pccons.c	Sun Jul 26 01:13:36 1992
***************
*** 155,161 ****
  	
  	while (inb(KBSTATP)&KBS_IBF);
  	if (val) outb(KBOUTP, val);
! 	while (inb(KBSTATP)&KBS_IBF);
  	return (inb(KBDATAP));
  }
  
--- 155,161 ----
  	
  	while (inb(KBSTATP)&KBS_IBF);
  	if (val) outb(KBOUTP, val);
! 	while (inb(KBSTATP)&KBS_DIB);
  	return (inb(KBDATAP));
  }
  
-- 
-- 
James R. Van Artsdalen          james@bigtex.cactus.org   "Live Free or Die"
Dell Computer Co    9505 Arboretum Blvd Austin TX 78759         512-338-8789