diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/utils/cpuid/cpuid_x86.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/lib/utils/cpuid/cpuid_x86.cpp b/src/lib/utils/cpuid/cpuid_x86.cpp index 7b99575ab..832e69871 100644 --- a/src/lib/utils/cpuid/cpuid_x86.cpp +++ b/src/lib/utils/cpuid/cpuid_x86.cpp @@ -32,13 +32,14 @@ void invoke_cpuid(uint32_t type, uint32_t out[4]) #if defined(BOTAN_BUILD_COMPILER_IS_MSVC) || defined(BOTAN_BUILD_COMPILER_IS_INTEL) __cpuid((int*)out, type); -#elif defined(BOTAN_TARGET_ARCH_IS_X86_64) && defined(BOTAN_USE_GCC_INLINE_ASM) +#elif defined(BOTAN_BUILD_COMPILER_IS_GCC) || defined(BOTAN_BUILD_COMPILER_IS_CLANG) + __get_cpuid(type, out, out+1, out+2, out+3); + +#elif defined(BOTAN_USE_GCC_INLINE_ASM) asm("cpuid\n\t" : "=a" (out[0]), "=b" (out[1]), "=c" (out[2]), "=d" (out[3]) : "0" (type)); -#elif defined(BOTAN_BUILD_COMPILER_IS_GCC) || defined(BOTAN_BUILD_COMPILER_IS_CLANG) - __get_cpuid(type, out, out+1, out+2, out+3); #else #warning "No way of calling x86 cpuid instruction for this compiler" clear_mem(out, 4); @@ -50,16 +51,14 @@ void invoke_cpuid_sublevel(uint32_t type, uint32_t level, uint32_t out[4]) #if defined(BOTAN_BUILD_COMPILER_IS_MSVC) __cpuidex((int*)out, type, level); -#elif defined(BOTAN_BUILD_COMPILER_IS_INTEL) - __cpuidex((int*)out, type, level); +#elif defined(BOTAN_BUILD_COMPILER_IS_GCC) || defined(BOTAN_BUILD_COMPILER_IS_CLANG) + __cpuid_count(type, level, out[0], out[1], out[2], out[3]); -#elif defined(BOTAN_TARGET_ARCH_IS_X86_64) && defined(BOTAN_USE_GCC_INLINE_ASM) +#elif defined(BOTAN_USE_GCC_INLINE_ASM) asm("cpuid\n\t" : "=a" (out[0]), "=b" (out[1]), "=c" (out[2]), "=d" (out[3]) \ : "0" (type), "2" (level)); -#elif defined(BOTAN_BUILD_COMPILER_IS_GCC) || defined(BOTAN_BUILD_COMPILER_IS_CLANG) - __cpuid_count(type, level, out[0], out[1], out[2], out[3]); #else #warning "No way of calling x86 cpuid instruction for this compiler" clear_mem(out, 4); |