Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/core/cpuid.d
Original file line number Diff line number Diff line change
Expand Up @@ -883,13 +883,20 @@ void cpuidX86()
}
// Intel P4 and PM pad at front with spaces.
// Other CPUs pad at end with nulls.
// However, be aware that some "prerelease" CPUs may have completely
// empty (spaces or nulls) values here.
int start = 0, end = 0;
while (cf.processorNameBuffer[start] == ' ') { ++start; }
while (cf.processorNameBuffer[cf.processorNameBuffer.length-end-1] == 0) { ++end; }
cf.processorName = cast(string)(cf.processorNameBuffer[start..$-end]);
while (cf.processorNameBuffer[start] == ' ' && start < cf.processorName.length) { ++start; }
while (cf.processorNameBuffer[cf.processorNameBuffer.length-end-1] == 0 && end < cf.processorName.length) { ++end; }
if (start < end) {
cf.processorName = cast(string)(cf.processorNameBuffer[start..$-end]);
} else {
cf.processorName = "Unknown CPU";
}
} else {
cf.processorName = "Unknown CPU";
}
/*
// Determine cache sizes

// Intel docs specify that they return 0 for 0x8000_0005.
Expand Down Expand Up @@ -944,6 +951,7 @@ void cpuidX86()
datacache[0].lineSize = 32;
}
}
*/
if (cf.probablyIntel && max_cpuid >= 0x0B) {
// For Intel i7 and later, use function 0x0B to determine
// cores and hyperthreads.
Expand Down