Skip to content
Snippets Groups Projects
Commit 2739e435 authored by psychocrypt's avatar psychocrypt
Browse files

fix avx destection

The OS is able to disable avx. In that case our avx detection is wrong.
See xmrig issue: https://github.com/xmrig/xmrig/issues/951

Import fix: https://github.com/xmrig/xmrig/commit/6052da3c4399514c95245b2d342f04baa20958db#diff-92fa29935c136762d35981769ac79f52

thx @xmrig for the notification.
parent f0c223bf
No related branches found
No related tags found
No related merge requests found
...@@ -37,9 +37,9 @@ namespace cpu ...@@ -37,9 +37,9 @@ namespace cpu
{ {
int32_t mask = 1 << bit; int32_t mask = 1 << bit;
return (val & mask) != 0u; return (val & mask) != 0u;
} }
Model getModel() Model getModel()
{ {
int32_t cpu_info[4]; int32_t cpu_info[4];
...@@ -53,7 +53,7 @@ namespace cpu ...@@ -53,7 +53,7 @@ namespace cpu
Model result; Model result;
cpuid(1, 0, cpu_info); cpuid(1, 0, cpu_info);
result.family = get_masked(cpu_info[0], 12, 8); result.family = get_masked(cpu_info[0], 12, 8);
result.model = get_masked(cpu_info[0], 8, 4) | get_masked(cpu_info[0], 20, 16) << 4; result.model = get_masked(cpu_info[0], 8, 4) | get_masked(cpu_info[0], 20, 16) << 4;
result.type_name = cpustr; result.type_name = cpustr;
...@@ -63,8 +63,8 @@ namespace cpu ...@@ -63,8 +63,8 @@ namespace cpu
result.sse2 = has_feature(cpu_info[3], 26); result.sse2 = has_feature(cpu_info[3], 26);
// aes-ni // aes-ni
result.aes = has_feature(cpu_info[2], 25); result.aes = has_feature(cpu_info[2], 25);
// avx // avx - 27 is the check if the OS overwrote cpu features
result.avx = has_feature(cpu_info[2], 28); result.avx = has_feature(cpu_info[2], 28) && has_feature(cpu_info[2], 27) ;
if(strcmp(cpustr, "AuthenticAMD") == 0) if(strcmp(cpustr, "AuthenticAMD") == 0)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment