diff options
Diffstat (limited to 'erts')
-rw-r--r-- | erts/include/internal/ethr_internal.h | 1 | ||||
-rw-r--r-- | erts/include/internal/ethread.h | 5 | ||||
-rw-r--r-- | erts/lib_src/common/ethr_aux.c | 15 |
3 files changed, 20 insertions, 1 deletions
diff --git a/erts/include/internal/ethr_internal.h b/erts/include/internal/ethr_internal.h index d4ded6ff05..693b34df61 100644 --- a/erts/include/internal/ethr_internal.h +++ b/erts/include/internal/ethr_internal.h @@ -92,7 +92,6 @@ void ethr_run_exit_handlers__(void); void ethr_ts_event_destructor__(void *vtsep); #if defined(ETHR_X86_RUNTIME_CONF__) -int ethr_x86_have_cpuid__(void); void ethr_x86_cpuid__(int *eax, int *ebx, int *ecx, int *edx); #endif diff --git a/erts/include/internal/ethread.h b/erts/include/internal/ethread.h index 4eeb7097f4..9956473057 100644 --- a/erts/include/internal/ethread.h +++ b/erts/include/internal/ethread.h @@ -282,6 +282,10 @@ ETHR_PROTO_NORETURN__ ethr_fatal_error__(const char *file, (__builtin_expect(ethr_runtime__.conf.have_sse2 != 0, 1)) # define ETHR_X86_RUNTIME_CONF_HAVE_NO_SSE2__ \ (__builtin_expect(ethr_runtime__.conf.have_sse2 == 0, 0)) +# define ETHR_X86_RUNTIME_CONF_HAVE_RDTSCP__ \ + (__builtin_expect(ethr_runtime__.conf.have_rdtscp != 0, 1)) +# define ETHR_X86_RUNTIME_CONF_HAVE_NO_RDTSCP__ \ + (__builtin_expect(ethr_runtime__.conf.have_rdtscp == 0, 0)) #endif #if (defined(__GNUC__) \ @@ -300,6 +304,7 @@ typedef struct { #if defined(ETHR_X86_RUNTIME_CONF__) int have_dw_cmpxchg; int have_sse2; + int have_rdtscp; #endif #if defined(ETHR_PPC_RUNTIME_CONF__) int have_lwsync; 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__ */ |