]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fix: wrong register for BMI1 bit (#112)
authorMat <mberchtold@gmail.com>
Mon, 29 May 2017 09:06:26 +0000 (11:06 +0200)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Mon, 29 May 2017 09:06:26 +0000 (11:06 +0200)
The BMI1 bit is in the ebx register and not in ecx.
See reference: https://software.intel.com/sites/default/files/article/405250/how-to-detect-new-instruction-support-in-the-4th-generation-intel-core-processor-family.pdf

arch/x86/x86.c

index cd933745f1edb9ab33cfb75d2b6fd964316f91dc..45bd63de2d67cead952e97cbe8ba72c64b7a3214 100644 (file)
@@ -54,5 +54,7 @@ void ZLIB_INTERNAL x86_check_features(void) {
 
        cpuid(7, &eax, &ebx, &ecx, &edx);
 
-       x86_cpu_has_tzcnt = ecx & 0x8;
+       // check BMI1 bit
+       // Reference: https://software.intel.com/sites/default/files/article/405250/how-to-detect-new-instruction-support-in-the-4th-generation-intel-core-processor-family.pdf
+       x86_cpu_has_tzcnt = ebx & 0x8;
 }