GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
i386

i386: Correct CPUID range checks for Centaur/Zhaoxin.

Fixes __get_cpuid() to correctly identify CPUID ranges including Centaur/Zhaoxin.

This commit rectifies an issue with the __get_cpuid() and __get_cpuid_count() functions on i386 architectures. Previously, a simple bitmask incorrectly categorized the Centaur/Zhaoxin CPUID range (0xC0000000) as the Extended range, leading to incorrect results. The fix replaces the bitmask with explicit range checks, accurately identifying all four CPUID ranges (Basic, Hypervisor, Extended, and Centaur/Zhaoxin) and improving feature detection for these processors.

In Details

Fixes __get_cpuid() and __get_cpuid_count() in config/i386/cpuid.h to correctly handle Centaur/Zhaoxin CPUID leaves starting from 0xC0000000. The previous bitmask check __leaf & 0x80000000 incorrectly mapped these to the Extended range (0x80000000) and also miscategorized the Hypervisor range (0x40000000). The change uses explicit range comparisons for accurate detection.

For Context
CPUID
A processor instruction that returns information about the CPU's capabilities and features. Different CPU vendors and ranges of leaves provide specific details.
Centaur/Zhaoxin
Manufacturers of x86-compatible processors. Their CPUs may support specific CPUID leaves in a unique range.
Hypervisor
Software that creates and runs virtual machines. CPUID leaves in the 0x40000000 range provide information about the system's hypervisor.
Filed Under: i386CPUIDCentaurZhaoxinfeature detection