If I execute this on a Dell T410, which has two Xeon E5530 Quad Core processors, I get the output shown below:
mov eax, 4
mov ebx, 0
mov ecx, 0
mov edx, 0
; at this point eax=0x1c004121, ebx=0x1c0003f, ecx=0x3f, edx=0x0
According to Intel AP-485: "The BIOS will use this function to determine the number of cores implemented in a specific physical processor package. To do this the BIOS must initially set the EAX register to 4 and the ECX register to 0 prior to executing the CPUID instruction. After executing the CPUID instruction, (EAX[31:26] + 1) contains the number of cores."
As you can see, EAX[31:26] is 7, so this package has 8 cores. But I know it only has 4. Can anyone tell me how to determine the number of cores in Intel processors that works for the E5530?
By the way, the number of logical processors works out to be 16, which I would expect as this processor is hyperthreaded. But again I know it actually has only 8 logical processors.
If I execute the CPUID instruction for all supported functions I get:
cpuid function, eax, ebx, ecx, edx
0x0, 0xb, 0x756e6547, 0x6c65746e, 0x49656e69,
0x1, 0x106a5, 0x7100800, 0x9ce3bd, 0xbfebfbff,
0x2, 0x55035a01, 0xf0b2e4, 0x0, 0x9ca212c,
0x3, 0x0, 0x0, 0x0, 0x0,
0x4, 0x1c004121, 0x1c0003f, 0x3f, 0x0,
0x5, 0x40, 0x40, 0x3, 0x1120,
0x6, 0x3, 0x2, 0x1, 0x0,
0x7, 0x0, 0x0, 0x0, 0x0,
0x8, 0x0, 0x0, 0x0, 0x0,
0x9, 0x0, 0x0, 0x0, 0x0,
0xa, 0x7300403, 0x44, 0x0, 0x603,
0xb, 0x1, 0x2, 0x100, 0x7,
0x80000000, 0x80000008, 0x0, 0x0, 0x0,
0x80000001, 0x0, 0x0, 0x1, 0x28100000,
0x80000002, 0x65746e49, 0x2952286c, 0x6f655820, 0x2952286e,
0x80000003, 0x55504320, 0x20202020, 0x20202020, 0x45202020,
0x80000004, 0x30333535, 0x20402020, 0x30342e32, 0x7a4847,
0x80000005, 0x0, 0x0, 0x0, 0x0,
0x80000006, 0x0, 0x0, 0x1006040, 0x0,
0x80000007, 0x0, 0x0, 0x0, 0x100,
0x80000008, 0x3028, 0x0, 0x0, 0x0,
Are you saying that if CPUID(1).EDX = 1, which means "The physical processor package is capable of supporting more than one logical processor", then the value of CPUID(4).EAX[31:26] + 1, 8 in this case, should be halved to get the actual number of cores? Nowhere in AP-485 does it say this.
Note that for this processor I also get CPUID(1).EBX[23:16] = 16, which means "Number of logical processors per physical processor package" is 16.
Quoting from AP-485, section 126.96.36.199, Cache Sharing Among Cores and Threads:
"The multi-core and threads fields give information about cache sharing. By comparing
the following three numbers:
1. Number of logical processors per physical processor package (CPUID.1.EBX[23:16])
2. Number of cores per physical package (CPUID.4.EAX[31:26] + 1)
3. Total number of threads serviced by this cache (CPUID.4.EAX[25:14] + 1)
Software can determine whether this cache is shared between cores, or specific to one
core, or even specific to one thread or a subset of threads. This feature is very important
with regard to logical processors since it is a means of differentiating a Hyper-Threading
technology processor from a multi-core processor or a multi-core processor with Hyper-
Threading Technology. Note that the sharing information was not available using the
cache descriptors returned by CPUID function 2. Refer to section 7.10.3 of the Intel@ 64
and IA-32 Software Developers Manual, Volume 3A: System Programming Guide."
I'm really confused.
UPDATE: I found the answer here: http://software.intel.com/en-us/articles/intel-64-architecture-processor-topology-enumeration/
It seems if leaf B is supported you must use that.
What I was trying to say is that each of these processors has 8 logical cores. 4 physical cores * 2, because of Hyper-Threading. However, this applies to each physical microprocessor (8 logical cores).
However, you can guide your CPUID question from the intel 64 architecture topology enumeration.