From: Nathan Moinvaziri Date: Fri, 26 Jan 2024 01:38:25 +0000 (-0800) Subject: Set registers to zero to prevent GCC __get_cpuid bug. X-Git-Tag: 2.2.0~112 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0dc9f73a092e5e3aa4d7c417c4b34f3843f3a30d;p=thirdparty%2Fzlib-ng.git Set registers to zero to prevent GCC __get_cpuid bug. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77756 --- diff --git a/arch/x86/x86_features.c b/arch/x86/x86_features.c index fcd4cb35..583fc35a 100644 --- a/arch/x86/x86_features.c +++ b/arch/x86/x86_features.c @@ -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 }