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

Commit

Permalink
Fix issue detecting AMD core count
Browse files Browse the repository at this point in the history
  • Loading branch information
rsw0x committed Aug 20, 2015
1 parent 8663f53 commit c3a9ff6
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/core/cpuid.d
Original file line number Diff line number Diff line change
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 c3a9ff6

Please sign in to comment.