diff options
author | Lukas Larsson <[email protected]> | 2016-02-02 17:17:46 +0100 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2016-02-02 17:17:46 +0100 |
commit | 246927d866b7de938cc58c95498f54b03869cbe5 (patch) | |
tree | 63c4846a861aec6051b4f31aa1c5f5186802855a /erts/lib_src/common/ethr_aux.c | |
parent | f45b817d0da8f9f61d2241d4f0eb06e47a6be86a (diff) | |
parent | f12da3c4abe70bd932484895af6e23436b308f53 (diff) | |
download | otp-246927d866b7de938cc58c95498f54b03869cbe5.tar.gz otp-246927d866b7de938cc58c95498f54b03869cbe5.tar.bz2 otp-246927d866b7de938cc58c95498f54b03869cbe5.zip |
Merge branch 'lukas/erts/msacc'
* lukas/erts/msacc:
Update preloaded modules
erts: Make msacc alloctor type thread safe
Silence compiler
erts: Fix msacc testcase on some windowses
erts: Add power saving cpu feature tests and use them
erts: Refactor perf counter internal interface
erts: Add rdtscp instruction check
erts: Fix hrtime for windows
erts: use correct function for perf counter on non-x86
erts: Fix msacc win32 debug compile error
erts: Add microstate accounting
erts, kernel: Add os:perf_counter function
erts: Add ERTS_WRITE_UNLIKELY
Diffstat (limited to 'erts/lib_src/common/ethr_aux.c')
-rw-r--r-- | erts/lib_src/common/ethr_aux.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/erts/lib_src/common/ethr_aux.c b/erts/lib_src/common/ethr_aux.c index 56fecf81b8..3e7aad16c7 100644 --- a/erts/lib_src/common/ethr_aux.c +++ b/erts/lib_src/common/ethr_aux.c @@ -139,6 +139,38 @@ 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) + return; + + if (eax >= 0x80000007) { + /* Advanced Power Management Information */ + eax = 0x80000007; + ethr_x86_cpuid__(&eax, &ebx, &ecx, &edx); + + /* I got the values below from: + http://lxr.free-electrons.com/source/arch/x86/include/asm/cpufeature.h + They can be gotten from the intel/amd manual as well. + */ + + ethr_runtime__.conf.have_constant_tsc = (edx & (1 << 8)); + ethr_runtime__.conf.have_tsc_reliable = (edx & (1 << 23)); + ethr_runtime__.conf.have_nonstop_tsc = (edx & (1 << 24)); + ethr_runtime__.conf.have_nonstop_tsc_s3 = (edx & (1 << 30)); + + } + + /* Extended Processor Info and Feature Bits */ + eax = 0x80000001; + ethr_x86_cpuid__(&eax, &ebx, &ecx, &edx); + + /* bit 27 of edx is set if we have rdtscp */ + ethr_runtime__.conf.have_rdtscp = (edx & (1 << 27)); + } #endif /* ETHR_X86_RUNTIME_CONF__ */ |