Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Issue 8973 - core.cpuid.coresPerCPU returning incorrect value. #1351

Merged
merged 1 commit into from
Aug 23, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 4 additions & 9 deletions src/core/cpuid.d
Expand Up @@ -735,15 +735,10 @@ void cpuidX86()
cpuid;
mov c, ECX;
}
uint apicsize = (c>>12) & 0xF;
if (apicsize == 0) {
// use legacy method
if (hyperThreadingBit) maxCores = c & 0xFF;
else maxCores = 1;
} else {
// maxcores = 2^ apicsize
maxCores = 1;
while (apicsize) { maxCores<<=1; --apicsize; }
//http://support.amd.com/TechDocs/25481.pdf pg.36
maxCores = 1;
if (hyperThreadingBit) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is reffered to a legacy method. Any reasons the so-called extended method cannot be used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using NC is the listed way to do it under the extended method. I believe the 'legacy' is referring to the deprecated LogicalProcessorCount, not NC.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right. All bits were confusingly list in legacy method section, still the only legacy fields are LogicalCpuCount and CmpLegacy

maxCores += c & 0xFF;
}
}

Expand Down