- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Whilst developing some software that reports information about x86 processors, I noticed something strange: Sandybridge processors report an incorrect core number.
This is how I'm retrieving the core number (pseudocode):
Move 0x00000004 into EAX
Move 0x00000000 into ECX
Call CPUID
Logical AND on bits EAX[31:26]
Shift EAX right by 26
Increase value of EAX by 1
On my primary test platform, an Intel Pentium T4500 (Penryn), it reports the core number correctly, as shown below:
However, on a separate machine with an Intel Core i5 2500K, it reports the core number incorrectly, as shown below:
Does anyone know why it is reporting double the number of cores it should? Both programs are running exactly the same code (and it isn't Windows 8, because I've tested on Windows 7 with a 2500K).
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
iliyapolak wrote:According to the reference I'm using, the logical processor count is available through a different value of EAX when calling CPUID (0x00000001 instead of 0x00000004).Maybe logical cores are also counted?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
iliyapolak wrote:I doubt it's being compiled wrongly as the same build of the program works on an AMD Athlon and my Pentium, but not any processors that are Sandybridge (I've tested on both an i5-2320 and two i5-2500Ks). The correct number of cores on a 2500K is 4.Can you use some tool to check for the correct number of cores?
I would often use windbg and issue !cpuid command.
Did you check your program with some kind of disassembler there is miniscule possibility of the code beign compiled wrongly.Run your tool also under debugger in single-step mode and observe what values are passed to/from registers and/or stack.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Patrick Fay (Intel) wrote:Ah, I haven't been using Intel architecture references. Thanks.The cpuid info doesn't report the current number of cores.
The current cpuid appnote says the field reports "Maximum number of processor cores".
This is not the same as the current number of cores.
You can look at http://software.intel.com/en-us/articles/intel-64-architecture-processor... for the method of figuring the number of cores.
Or use what the OS reports.
Pat

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page