aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libc/x86/sys/__vdso_gettc.c
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2019-02-14 13:59:00 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2019-02-14 13:59:00 +0000
commitb5d72efb7a3edaf7a1bfd0f36c75151aa412e4c2 (patch)
tree1c851e183336f182e90f86e5b88073894c49ec6e /lib/libc/x86/sys/__vdso_gettc.c
parent642bb66b63cf5d199e99df898a26238d7aed86da (diff)
downloadsrc-b5d72efb7a3edaf7a1bfd0f36c75151aa412e4c2.tar.gz
src-b5d72efb7a3edaf7a1bfd0f36c75151aa412e4c2.zip
x86 __vdso_gettc(): use machine/cpufunc.h function for CPUID.
Based on the discussion with: jkim Sponsored by: The FreeBSD Foundation MFC after: 1 week
Notes
Notes: svn path=/head/; revision=344119
Diffstat (limited to 'lib/libc/x86/sys/__vdso_gettc.c')
-rw-r--r--lib/libc/x86/sys/__vdso_gettc.c29
1 files changed, 2 insertions, 27 deletions
diff --git a/lib/libc/x86/sys/__vdso_gettc.c b/lib/libc/x86/sys/__vdso_gettc.c
index 3a56b4af7bd9..0781e97e2ce5 100644
--- a/lib/libc/x86/sys/__vdso_gettc.c
+++ b/lib/libc/x86/sys/__vdso_gettc.c
@@ -54,31 +54,6 @@ __FBSDID("$FreeBSD$");
#include "libc_private.h"
static void
-cpuidp(u_int leaf, u_int p[4])
-{
-
- __asm __volatile(
-#if defined(__i386__)
- " pushl %%ebx\n"
-#endif
- " cpuid\n"
-#if defined(__i386__)
- " movl %%ebx,%1\n"
- " popl %%ebx"
-#endif
- : "=a" (p[0]),
-#if defined(__i386__)
- "=r" (p[1]),
-#elif defined(__amd64__)
- "=b" (p[1]),
-#else
-#error "Arch"
-#endif
- "=c" (p[2]), "=d" (p[3])
- : "0" (leaf));
-}
-
-static void
rdtsc_mb_lfence(void)
{
@@ -100,12 +75,12 @@ rdtsc_mb_none(void)
DEFINE_UIFUNC(static, void, rdtsc_mb, (void), static)
{
u_int p[4];
- /* Not a typo, string matches our cpuidp() registers use. */
+ /* Not a typo, string matches our do_cpuid() registers use. */
static const char intel_id[] = "GenuntelineI";
if ((cpu_feature & CPUID_SSE2) == 0)
return (rdtsc_mb_none);
- cpuidp(0, p);
+ do_cpuid(0, p);
return (memcmp(p + 1, intel_id, sizeof(intel_id) - 1) == 0 ?
rdtsc_mb_lfence : rdtsc_mb_mfence);
}