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

Commit

Permalink
Merge pull request #1351 from rsw0x/issue_8973
Browse files Browse the repository at this point in the history
Issue 8973 - core.cpuid.coresPerCPU returning incorrect value.
  • Loading branch information
DmitryOlshansky committed Aug 23, 2015
2 parents dad70ec + c3a9ff6 commit f3d9ec7
Showing 1 changed file with 4 additions and 9 deletions.
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) {
maxCores += c & 0xFF;
}
}

Expand Down

0 comments on commit f3d9ec7

Please sign in to comment.