diff options
author | Roman Dubtsov <[email protected]> | 2020-01-17 15:58:12 -0800 |
---|---|---|
committer | Roman Dubtsov <[email protected]> | 2020-01-17 15:58:12 -0800 |
commit | 5722393d41218fcf32a69127c725f0fb1e030ba5 (patch) | |
tree | 74f974ff1e7e94bd21600ed7dc8baa0547802636 | |
parent | 6a4459a83a085af94c75bacf91718fbe57857359 (diff) | |
download | xbyak-5722393d41218fcf32a69127c725f0fb1e030ba5.tar.gz xbyak-5722393d41218fcf32a69127c725f0fb1e030ba5.zip |
fix for zeroed-out 0xb leaf
Hypervisors may indicate x2APIC support but
sill have zeroes in the 0xb leaf. This patch
slightly improves behavior in such a case.
-rw-r--r-- | xbyak/xbyak_util.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/xbyak/xbyak_util.h b/xbyak/xbyak_util.h index eefd152..4b3c9ba 100644 --- a/xbyak/xbyak_util.h +++ b/xbyak/xbyak_util.h @@ -146,6 +146,11 @@ class Cpu { numCores_[level - 1] = extractBit(data[1], 0, 15); } } + /* + Fallback values in case a hypervisor has 0xB leaf zeroed-out. + */ + numCores_[SmtLevel - 1] = std::max(1u, numCores_[SmtLevel - 1]); + numCores_[CoreLevel - 1] = std::max(numCores_[SmtLevel - 1], numCores_[CoreLevel - 1]); } else { /* Failed to deremine num of cores without x2APIC support. |