From dc1e3933e633d9d7527e6df044895d12d3845e14 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Thu, 16 Jul 2015 11:24:51 +0200 Subject: erts: Add rdtscp instruction check --- erts/lib_src/common/ethr_aux.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'erts/lib_src/common/ethr_aux.c') diff --git a/erts/lib_src/common/ethr_aux.c b/erts/lib_src/common/ethr_aux.c index 56fecf81b8..fbd870c2b5 100644 --- a/erts/lib_src/common/ethr_aux.c +++ b/erts/lib_src/common/ethr_aux.c @@ -139,6 +139,21 @@ x86_init(void) #endif /* bit 26 of edx is set if we have sse2 */ ethr_runtime__.conf.have_sse2 = (edx & (1 << 26)); + + /* check if we have extended feature set */ + eax = 0x80000000; + ethr_x86_cpuid__(&eax, &ebx, &ecx, &edx); + + if (eax >= 0x80000001) { + /* Get the extended feature set */ + eax = 0x80000001; + ethr_x86_cpuid__(&eax, &ebx, &ecx, &edx); + } else { + eax = ebx = ecx = edx = 0; + } + + /* bit 27 of edx is set if we have rdtscp */ + ethr_runtime__.conf.have_rdtscp = (edx & (1 << 27)); } #endif /* ETHR_X86_RUNTIME_CONF__ */ -- cgit v1.2.3