From owner-freebsd-current Wed Dec 20 17:11:46 1995 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id RAA27646 for current-outgoing; Wed, 20 Dec 1995 17:11:46 -0800 (PST) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id RAA27638 for ; Wed, 20 Dec 1995 17:11:26 -0800 (PST) Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.9/8.6.9) id MAA26975; Thu, 21 Dec 1995 12:06:57 +1100 Date: Thu, 21 Dec 1995 12:06:57 +1100 From: Bruce Evans Message-Id: <199512210106.MAA26975@godzilla.zeta.org.au> To: current@FreeBSD.ORG, kato@eclogite.eps.nagoya-u.ac.jp Subject: Re: outb in random.c Sender: owner-current@FreeBSD.ORG Precedence: bulk The function add_timer_randomness() in sys/i386/isa/random.c contains: > outb(TIMER_LATCH|TIMER_SEL0, TIMER_MODE); /* latch the count ASAP */ >This is outb(data, port). I think this should be > outb(TIMER_MODE, TIMER_LATCH|TIMER_SEL0); /* latch the count ASAP */ Gak! outb() and inb() are well known to have back to front args in Linux, where this code was derived from. This outb clobbers i/o port 0 (part of the address for DMA channel 0) and the following inb's give a result that is random in a different way than was intended. Bruce