Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/usermode fix timecounter



details:   https://anonhg.NetBSD.org/src/rev/ca38380c49d5
branches:  trunk
changeset: 772021:ca38380c49d5
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Tue Dec 13 22:22:08 2011 +0000

description:
fix timecounter

diffstat:

 sys/arch/usermode/dev/clock.c      |  7 +++----
 sys/arch/usermode/usermode/thunk.c |  9 +++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diffs (79 lines):

diff -r 991c46e81373 -r ca38380c49d5 sys/arch/usermode/dev/clock.c
--- a/sys/arch/usermode/dev/clock.c     Tue Dec 13 20:59:20 2011 +0000
+++ b/sys/arch/usermode/dev/clock.c     Tue Dec 13 22:22:08 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.21 2011/12/09 17:23:33 reinoud Exp $ */
+/* $NetBSD: clock.c,v 1.22 2011/12/13 22:22:08 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.21 2011/12/09 17:23:33 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.22 2011/12/13 22:22:08 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -63,7 +63,7 @@
        clock_getcounter,       /* get_timecount */
        0,                      /* no poll_pps */
        ~0u,                    /* counter_mask */
-       0,                      /* frequency */
+       1000000000ULL,          /* frequency */
        "CLOCK_MONOTONIC",      /* name */
        -100,                   /* quality */
        NULL,                   /* prev */
@@ -117,7 +117,6 @@
        tcres = thunk_clock_getres_monotonic();
        if (tcres > 0) {
                clock_timecounter.tc_quality = 1000;
-               clock_timecounter.tc_frequency = 1000000000 / tcres;
        }
        tc_init(&clock_timecounter);
 }
diff -r 991c46e81373 -r ca38380c49d5 sys/arch/usermode/usermode/thunk.c
--- a/sys/arch/usermode/usermode/thunk.c        Tue Dec 13 20:59:20 2011 +0000
+++ b/sys/arch/usermode/usermode/thunk.c        Tue Dec 13 22:22:08 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.42 2011/12/12 16:39:16 jmcneill Exp $ */
+/* $NetBSD: thunk.c,v 1.43 2011/12/13 22:22:08 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifdef __NetBSD__
-__RCSID("$NetBSD: thunk.c,v 1.42 2011/12/12 16:39:16 jmcneill Exp $");
+__RCSID("$NetBSD: thunk.c,v 1.43 2011/12/13 22:22:08 jmcneill Exp $");
 #endif
 
 #include <sys/types.h>
@@ -46,6 +46,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <signal.h>
+#include <string.h>
 #include <termios.h>
 #include <time.h>
 #include <ucontext.h>
@@ -211,7 +212,7 @@
                abort();
        }
 
-       return (unsigned int)(ts.tv_sec * 1000000000ULL + ts.tv_nsec);
+       return (unsigned int)(ts.tv_nsec % 1000000000ULL);
 }
 
 long
@@ -224,7 +225,7 @@
        if (error)
                return -1;
 
-       return res.tv_nsec;
+       return (long)(res.tv_sec * 1000000000ULL + res.tv_nsec);
 }
 
 int



Home | Main Index | Thread Index | Old Index