summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_tc.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2016-09-16 10:04:28 +0000
committerkib <kib@FreeBSD.org>2016-09-16 10:04:28 +0000
commitdddfacf75a4db48e5a557d2ca395fcf246f37b70 (patch)
treeea58970436c8250f3ddf63bd4caeee598547c297 /sys/kern/kern_tc.c
parent4a1f75f05099b39074e0485603c771634cb71527 (diff)
downloadFreeBSD-src-dddfacf75a4db48e5a557d2ca395fcf246f37b70.zip
FreeBSD-src-dddfacf75a4db48e5a557d2ca395fcf246f37b70.tar.gz
MFC r304285:
Implement userspace gettimeofday(2) with HPET timecounter.
Diffstat (limited to 'sys/kern/kern_tc.c')
-rw-r--r--sys/kern/kern_tc.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c
index 4319123..9cc5f42 100644
--- a/sys/kern/kern_tc.c
+++ b/sys/kern/kern_tc.c
@@ -6,11 +6,14 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * Copyright (c) 2011 The FreeBSD Foundation
+ * Copyright (c) 2011, 2015, 2016 The FreeBSD Foundation
* All rights reserved.
*
* Portions of this software were developed by Julien Ridoux at the University
* of Melbourne under sponsorship from the FreeBSD Foundation.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
*/
#include <sys/cdefs.h>
@@ -2134,13 +2137,16 @@ tc_fill_vdso_timehands(struct vdso_timehands *vdso_th)
uint32_t enabled;
th = timehands;
- vdso_th->th_algo = VDSO_TH_ALGO_1;
vdso_th->th_scale = th->th_scale;
vdso_th->th_offset_count = th->th_offset_count;
vdso_th->th_counter_mask = th->th_counter->tc_counter_mask;
vdso_th->th_offset = th->th_offset;
vdso_th->th_boottime = th->th_boottime;
- enabled = cpu_fill_vdso_timehands(vdso_th, th->th_counter);
+ if (th->th_counter->tc_fill_vdso_timehands != NULL) {
+ enabled = th->th_counter->tc_fill_vdso_timehands(vdso_th,
+ th->th_counter);
+ } else
+ enabled = 0;
if (!vdso_th_enable)
enabled = 0;
return (enabled);
@@ -2154,7 +2160,6 @@ tc_fill_vdso_timehands32(struct vdso_timehands32 *vdso_th32)
uint32_t enabled;
th = timehands;
- vdso_th32->th_algo = VDSO_TH_ALGO_1;
*(uint64_t *)&vdso_th32->th_scale[0] = th->th_scale;
vdso_th32->th_offset_count = th->th_offset_count;
vdso_th32->th_counter_mask = th->th_counter->tc_counter_mask;
@@ -2162,7 +2167,11 @@ tc_fill_vdso_timehands32(struct vdso_timehands32 *vdso_th32)
*(uint64_t *)&vdso_th32->th_offset.frac[0] = th->th_offset.frac;
vdso_th32->th_boottime.sec = th->th_boottime.sec;
*(uint64_t *)&vdso_th32->th_boottime.frac[0] = th->th_boottime.frac;
- enabled = cpu_fill_vdso_timehands32(vdso_th32, th->th_counter);
+ if (th->th_counter->tc_fill_vdso_timehands32 != NULL) {
+ enabled = th->th_counter->tc_fill_vdso_timehands32(vdso_th32,
+ th->th_counter);
+ } else
+ enabled = 0;
if (!vdso_th_enable)
enabled = 0;
return (enabled);
OpenPOWER on IntegriCloud