Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sparc/sparc Account for the number of counter ticks...



details:   https://anonhg.NetBSD.org/src/rev/829d7c2536d4
branches:  trunk
changeset: 508332:829d7c2536d4
user:      pk <pk%NetBSD.org@localhost>
date:      Mon Apr 09 21:28:50 2001 +0000

description:
Account for the number of counter ticks that elapse while statintr()
processing takes place. This prevents stat clock skew by a factor
approximately proportional to stathz (not a serious problem if stathz==100;
but considerable already if stathz==1000).

diffstat:

 sys/arch/sparc/sparc/clock.c |  15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r c294957a73f8 -r 829d7c2536d4 sys/arch/sparc/sparc/clock.c
--- a/sys/arch/sparc/sparc/clock.c      Mon Apr 09 21:18:00 2001 +0000
+++ b/sys/arch/sparc/sparc/clock.c      Mon Apr 09 21:28:50 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clock.c,v 1.78 2001/01/20 13:44:29 pk Exp $ */
+/*     $NetBSD: clock.c,v 1.79 2001/04/09 21:28:50 pk Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -1040,10 +1040,21 @@
        newint = statmin + r;
 
        if (CPU_ISSUN4M) {
-               counterreg4m->t_limit = tmr_ustolim4m(newint);
+               /*
+                * Use the `non-resetting' limit register, so we don't
+                * loose the counter ticks that happened since this
+                * interrupt was raised.
+                */
+               counterreg4m->t_limit_nr = tmr_ustolim4m(newint);
        }
 
        if (CPU_ISSUN4OR4C) {
+               /*
+                * The sun4/4c timer has no `non-resetting' register;
+                * use the current counter value to compensate the new
+                * limit value for the number of counter ticks elapsed.
+                */
+               newint -= tmr_cnttous(timerreg4->t_c14.t_counter);
                timerreg4->t_c14.t_limit = tmr_ustolim(newint);
        }
        return (1);



Home | Main Index | Thread Index | Old Index