From owner-freebsd-hackers Mon May 3 20:50:15 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from alpo.whistle.com (alpo.whistle.com [207.76.204.38]) by hub.freebsd.org (Postfix) with ESMTP id A2118157D1 for ; Mon, 3 May 1999 20:50:07 -0700 (PDT) (envelope-from julian@whistle.com) Received: from current1.whistle.com (current1.whistle.com [207.76.205.22]) by alpo.whistle.com (8.9.1a/8.9.1) with SMTP id UAA41446; Mon, 3 May 1999 20:46:31 -0700 (PDT) Date: Mon, 3 May 1999 20:46:29 -0700 (PDT) From: Julian Elischer To: Kevin Day Cc: hackers@FreeBSD.ORG Subject: Re: Clock code patch sought. In-Reply-To: <199905040320.WAA09953@home.dragondata.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Mon, 3 May 1999, Kevin Day wrote: > > There was a patch floating around that re-read the clock registers several > > times for broken hardware, to get rid of the problems of user time going > > backwards due to misreads. > > > > I have been unable to find exact references in the archives.. > > does anyone remember the patches in question? > > > > It was within the last year.. > > > > julian > > > > > > http://www.freebsd.org/cgi/query-pr.cgi?pr=6630 > > Take a look. > > I had to modify it to do 4 reads, instead of 2 though. like this? retrieving revision 1.129 diff -u -r1.129 clock.c --- clock.c 1998/12/14 13:30:29 1.129 +++ clock.c 1999/05/04 03:44:52 @@ -416,6 +416,9 @@ { u_long ef; int high, low; +#if CPU_CYRIX_NO_I8254_LATCH + int ret1, ret2; +#endif ef = read_eflags(); disable_intr(); @@ -425,10 +428,35 @@ low = inb(TIMER_CNTR0); high = inb(TIMER_CNTR0); +#if CPU_CYRIX_NO_I8254_LATCH + ret1 = (high << 8) | low; + outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH); + low = inb(TIMER_CNTR0); + high= inb(TIMER_CNTR0); + ret2 = (high <<8) | low; + ret1 = ret1 > ret2 ? ret1 : ret2; + + outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH); + low = inb(TIMER_CNTR0); + high= inb(TIMER_CNTR0); + ret2 = (high <<8) | low; + ret1 = ret1 > ret2 ? ret1 : ret2; + + outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH); + low = inb(TIMER_CNTR0); + high= inb(TIMER_CNTR0); + ret2 = (high <<8) | low; + ret1 = ret1 > ret2 ? ret1 : ret2; +#endif + CLOCK_UNLOCK(); write_eflags(ef); +#if CPU_CYRIX_NO_I8254_LATCH + return (ret1); +#else return ((high << 8) | low); +#endif } > > > Kevin > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-hackers" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message