]> 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>
Wed, 19 Jun 2024 12:15:54 +0000 (14:15 +0200)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77756

arch/x86/x86_features.c

index 8d11564c24f94ba72bf7307b60406bf8e83c8b44..e261b70fe8a738bc55642700dcfa652f6f5bd5b2 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
 }