| 106 | } |
| 107 | |
| 108 | CPU getCPUModel() |
| 109 | { |
| 110 | #if defined(__X86_ASM__) |
| 111 | if (getCPUVendor() != "GenuineIntel") |
| 112 | return CPU::UNKNOWN; |
| 113 | |
| 114 | int out[4]; |
| 115 | __cpuid(out, 0); |
| 116 | if (out[0] < 1) return CPU::UNKNOWN; |
| 117 | __cpuid(out, 1); |
| 118 | |
| 119 | /* please see CPUID documentation for these formulas */ |
| 120 | uint32_t family_ID = (out[0] >> 8) & 0x0F; |
| 121 | uint32_t extended_family_ID = (out[0] >> 20) & 0xFF; |
| 122 | |
| 123 | uint32_t model_ID = (out[0] >> 4) & 0x0F; |
| 124 | uint32_t extended_model_ID = (out[0] >> 16) & 0x0F; |
| 125 | |
| 126 | uint32_t DisplayFamily = family_ID; |
| 127 | if (family_ID == 0x0F) |
| 128 | DisplayFamily += extended_family_ID; |
| 129 | |
| 130 | uint32_t DisplayModel = model_ID; |
| 131 | if (family_ID == 0x06 || family_ID == 0x0F) |
| 132 | DisplayModel += extended_model_ID << 4; |
| 133 | |
| 134 | uint32_t DisplayFamily_DisplayModel = (DisplayFamily << 8) + (DisplayModel << 0); |
| 135 | |
| 136 | // Data from Intel® 64 and IA-32 Architectures, Volume 4, Chapter 2, Table 2-1 (CPUID Signature Values of DisplayFamily_DisplayModel) |
| 137 | if (DisplayFamily_DisplayModel == 0x067D) return CPU::CORE_ICE_LAKE; |
| 138 | if (DisplayFamily_DisplayModel == 0x067E) return CPU::CORE_ICE_LAKE; |
| 139 | if (DisplayFamily_DisplayModel == 0x068C) return CPU::CORE_TIGER_LAKE; |
| 140 | if (DisplayFamily_DisplayModel == 0x06A5) return CPU::CORE_COMET_LAKE; |
| 141 | if (DisplayFamily_DisplayModel == 0x06A6) return CPU::CORE_COMET_LAKE; |
| 142 | if (DisplayFamily_DisplayModel == 0x0666) return CPU::CORE_CANNON_LAKE; |
| 143 | if (DisplayFamily_DisplayModel == 0x068E) return CPU::CORE_KABY_LAKE; |
| 144 | if (DisplayFamily_DisplayModel == 0x069E) return CPU::CORE_KABY_LAKE; |
| 145 | if (DisplayFamily_DisplayModel == 0x066A) return CPU::XEON_ICE_LAKE; |
| 146 | if (DisplayFamily_DisplayModel == 0x066C) return CPU::XEON_ICE_LAKE; |
| 147 | if (DisplayFamily_DisplayModel == 0x0655) return CPU::XEON_SKY_LAKE; |
| 148 | if (DisplayFamily_DisplayModel == 0x064E) return CPU::CORE_SKY_LAKE; |
| 149 | if (DisplayFamily_DisplayModel == 0x065E) return CPU::CORE_SKY_LAKE; |
| 150 | if (DisplayFamily_DisplayModel == 0x0656) return CPU::XEON_BROADWELL; |
| 151 | if (DisplayFamily_DisplayModel == 0x064F) return CPU::XEON_BROADWELL; |
| 152 | if (DisplayFamily_DisplayModel == 0x0647) return CPU::CORE_BROADWELL; |
| 153 | if (DisplayFamily_DisplayModel == 0x063D) return CPU::CORE_BROADWELL; |
| 154 | if (DisplayFamily_DisplayModel == 0x063F) return CPU::XEON_HASWELL; |
| 155 | if (DisplayFamily_DisplayModel == 0x063C) return CPU::CORE_HASWELL; |
| 156 | if (DisplayFamily_DisplayModel == 0x0645) return CPU::CORE_HASWELL; |
| 157 | if (DisplayFamily_DisplayModel == 0x0646) return CPU::CORE_HASWELL; |
| 158 | if (DisplayFamily_DisplayModel == 0x063E) return CPU::XEON_IVY_BRIDGE; |
| 159 | if (DisplayFamily_DisplayModel == 0x063A) return CPU::CORE_IVY_BRIDGE; |
| 160 | if (DisplayFamily_DisplayModel == 0x062D) return CPU::SANDY_BRIDGE; |
| 161 | if (DisplayFamily_DisplayModel == 0x062F) return CPU::SANDY_BRIDGE; |
| 162 | if (DisplayFamily_DisplayModel == 0x062A) return CPU::SANDY_BRIDGE; |
| 163 | if (DisplayFamily_DisplayModel == 0x062E) return CPU::NEHALEM; |
| 164 | if (DisplayFamily_DisplayModel == 0x0625) return CPU::NEHALEM; |
| 165 | if (DisplayFamily_DisplayModel == 0x062C) return CPU::NEHALEM; |
no test coverage detected