CPUID, EAX=4 - Strange results (Solved)

CPUID, EAX=4 - Strange results (Solved)

I am trying to use CPUID, EAX = 4 to retrieve the number of cores on the die.
This method was detailed in an Intel training video.I believe the processor is a xeon, dual processor but I have tried several intel machines around my place of work.

Having checked the leaf is available (CPUID.EAX(0)), I set

EAX=4, ECX=0 and call CPUID.
I want to check bits[31:26]

The result returned in EAX is (on all machines) 0x665b5001.

This gives 26 cores/die which is obviously incorrect.

What am I missing?

Cheers, Rob

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

A typo in Cut&Pasted code meant I wasn't checking for leaf availability correctly.

Please ignore

OK, we'll call off our engineers then :)

For purposes of illustration, one of our engineering contacts composed the following reply before we found out you'd solved it youself. This explains theissue in more detail for any readers who were wondering:

It looks like the value 665b5001 is a return value of the highest CPUID leaf that is supported at that particular runtime configuration, which appears to be configured improperly for normal use.

When software executes CPUID with an invalide EAX input value (i.e. leaf index), CPUID will report with the the highest leaf that it supports under the current runtime configuration.

SomeBIOS versionshave a menu setting that allows the user to limit the max value (or leaf index) that CPUID will support after the next reboot. TheBIOS provided this option solely for the purpose of allowing theend-user towork around a Microsoft Windows* NT 4.0 installation issue, because Windows NT 4.0s installation program had a bug and would blue-screen if CPUID reported it supports leaves higher than 3. Enabling theBIOS option to limit CPUIDs EAX maxvalue to 3 is needed only for the purpose of installing Windows NT 4.0. In all other situation,the BIOS should be configured to not restrict CPUID EAX max values. When CPUID is limited with the restriction that it supports no higher leaves than 3, on theIntel Pentium 4 and later processor, leaf 3 is not supported, so requesting CPUID to report leaf 4 will receive data from CPUID on leaf 2 (the highest leaf index).

CPUID will report the EAX max value it supports when software executes CPUID with EAX set to 0 on input. In the case above,this basic step was overlooked,assuming any returned CPUID values were valid.


Lexi S.

IntelSoftware NetworkSupport


Contact us

Leave a Comment

Please sign in to add a comment. Not a member? Join today