summaryrefslogtreecommitdiffstats
path: root/lib/libc/amd64/sys/__vdso_gettc.c
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2015-09-12 12:03:02 +0000
committerbapt <bapt@FreeBSD.org>2015-09-12 12:03:02 +0000
commit934c5c6da6753f906bc4a905e249449fd15b850d (patch)
tree38501bd60c958b3b5474368fc0834fe6d09c307a /lib/libc/amd64/sys/__vdso_gettc.c
parentef64c24c72a0a1e4bc5beba3e1c3d78af363773d (diff)
parentceb1e1488d523eff8fa06828cf0511fc2556c0ef (diff)
downloadFreeBSD-src-934c5c6da6753f906bc4a905e249449fd15b850d.zip
FreeBSD-src-934c5c6da6753f906bc4a905e249449fd15b850d.tar.gz
Finish merging from head, messed up in previous attempt
Diffstat (limited to 'lib/libc/amd64/sys/__vdso_gettc.c')
-rw-r--r--lib/libc/amd64/sys/__vdso_gettc.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/libc/amd64/sys/__vdso_gettc.c b/lib/libc/amd64/sys/__vdso_gettc.c
index c6f2dfb..1899b21 100644
--- a/lib/libc/amd64/sys/__vdso_gettc.c
+++ b/lib/libc/amd64/sys/__vdso_gettc.c
@@ -36,19 +36,29 @@ __FBSDID("$FreeBSD$");
static u_int
__vdso_gettc_low(const struct vdso_timehands *th)
{
- uint32_t rv;
+ u_int rv;
- __asm __volatile("rdtsc; shrd %%cl, %%edx, %0"
+ __asm __volatile("lfence; rdtsc; shrd %%cl, %%edx, %0"
: "=a" (rv) : "c" (th->th_x86_shift) : "edx");
return (rv);
}
+static u_int
+__vdso_rdtsc32(void)
+{
+ u_int rv;
+
+ __asm __volatile("lfence;rdtsc" : "=a" (rv) : : "edx");
+ return (rv);
+}
+
#pragma weak __vdso_gettc
u_int
__vdso_gettc(const struct vdso_timehands *th)
{
- return (th->th_x86_shift > 0 ? __vdso_gettc_low(th) : rdtsc32());
+ return (th->th_x86_shift > 0 ? __vdso_gettc_low(th) :
+ __vdso_rdtsc32());
}
#pragma weak __vdso_gettimekeep
OpenPOWER on IntegriCloud