]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Set registers to zero to prevent GCC __get_cpuid bug.
authorNathan Moinvaziri <nathan@nathanm.com>
Fri, 26 Jan 2024 01:38:25 +0000 (17:38 -0800)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Sat, 27 Jan 2024 23:27:43 +0000 (00:27 +0100)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77756

arch/x86/x86_features.c

index fcd4cb35a6345a76e4569715d4af4e397e6ca484..583fc35a9289560ca4ba1613b6d9fb6b9b8e3111 100644 (file)
@@ -29,6 +29,7 @@ static inline void cpuid(int info, unsigned* eax, unsigned* ebx, unsigned* ecx,
     *ecx = registers[2];
     *edx = registers[3];
 #else
+    *eax = *ebx = *ecx = *edx = 0;
     __cpuid(info, *eax, *ebx, *ecx, *edx);
 #endif
 }
@@ -43,6 +44,7 @@ static inline void cpuidex(int info, int subinfo, unsigned* eax, unsigned* ebx,
     *ecx = registers[2];
     *edx = registers[3];
 #else
+    *eax = *ebx = *ecx = *edx = 0;
     __cpuid_count(info, subinfo, *eax, *ebx, *ecx, *edx);
 #endif
 }