Better cpuid support

Alexandre Julliard julliard at
Wed Jan 14 23:53:49 CST 2004

Robert Lunnon <bobl at> writes:

> 1. The original cpuid and i386 detect are merged into a single assembly call 
> for convenience.

Much less readable IMO.

> 2. The data is then interpreted into a structure for use. Understanding CPUID 
> means knowing the cpuid_t structure and CPUID_IsFeatureAvailable call. All 
> the specifics are isolated into GetId for maintainablity. 

There's no reason to introduce that structure, we can set the Windows
fields directly. We don't need the specifics of CPUID anywhere else
than for setting the corresponding bits which already have well
defined names.

> 3. The OS Specifics for testing OS support of multiple CPUs and SSE were moved 
> into their own subroutines. This abstracts these functions to permit the code 
> in the FREEBSD section to be OS independent. Note that I copied/added code to 
> each of these subroutines to support all the platforms that were already 
> supported for that feature. Much of this code is currently redundant unless 
> someone wants to change the existing linux or NETBSD sections (Which 
> currently use other methods). The redundant code was added to allow this to 
> happen.

On linux your new code will cause multiple opening and parsing of
/proc/cpuinfo (and leak file descriptors...)

> 3. The information collection and feature tests in the FREEBSD code were 
> changed to use cpuid_t and IsFeatureAvailable in a way exactly equivalent to 
> the original adding support for detection of PAE and SSE in the process 
> (Though OS_SSESupported will need a test for SSE for FREEBSD to work)  There 
> is no test for Solaris SSE test since SSE isn't supported at all there (Yet). 

The new IsFeatureAvailable thing results in calling cpuid and parsing
the results again and again at least a dozen times for no good reason.

Please consider working with the existing code instead of throwing it
all away and replacing it by your own favorite routines which simply
don't fit in with the rest of the code.

Alexandre Julliard
julliard at

More information about the wine-devel mailing list