aboutsummaryrefslogtreecommitdiffstats
path: root/erts/lib_src/common/ethr_aux.c
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2015-07-16 11:24:51 +0200
committerLukas Larsson <[email protected]>2016-02-02 10:45:22 +0100
commitdc1e3933e633d9d7527e6df044895d12d3845e14 (patch)
tree45ae1272d657fc2a47178cfedc1c29105e92c318 /erts/lib_src/common/ethr_aux.c
parent2181f97655906dac3b18333c149c384e1dc81c2b (diff)
downloadotp-dc1e3933e633d9d7527e6df044895d12d3845e14.tar.gz
otp-dc1e3933e633d9d7527e6df044895d12d3845e14.tar.bz2
otp-dc1e3933e633d9d7527e6df044895d12d3845e14.zip
erts: Add rdtscp instruction check
Diffstat (limited to 'erts/lib_src/common/ethr_aux.c')
-rw-r--r--erts/lib_src/common/ethr_aux.c15
1 files changed, 15 insertions, 0 deletions
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__ */