Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 May 1999 20:46:29 -0700 (PDT)
From:      Julian Elischer <julian@whistle.com>
To:        Kevin Day <toasty@home.dragondata.com>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Clock code patch sought.
Message-ID:  <Pine.BSF.3.95.990503204501.9332F-100000@current1.whistle.com>
In-Reply-To: <199905040320.WAA09953@home.dragondata.com>

next in thread | previous in thread | raw e-mail | index | archive | help


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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95.990503204501.9332F-100000>