| ... | ... | @@ -76,7 +76,13 @@ pub fn detectNativeCpuAndFeatures(arch: Target.Cpu.Arch, os: Target.Os, query: T |
| 76 | 76 | 0x756e6547 => detectIntelProcessor(&cpu, family, model, brand_id), |
| 77 | 77 | 0x68747541 => detectAmdProcessor(&cpu, family, model), |
| 78 | 78 | else => null, |
| 79 | | }) |m| { |
| 79 | }) |m| b: { |
| 80 | // Some hypervisors are evil liars and will operate in long mode while identifying as a |
| 81 | // CPU model that never had long mode in reality. We've seen this in practice with |
| 82 | // athlon_xp (AMD K7). Catch this contradiction and fall back to using a generic CPU |
| 83 | // model with the features we detected earlier. |
| 84 | if (cpu.has(.x86, .@"64bit") and !Target.x86.featureSetHas(m.features, .@"64bit")) break :b; |
| 85 | |
| 80 | 86 | cpu.model = m; |
| 81 | 87 | } |
| 82 | 88 | } |