27 lines
1.1 KiB
Diff
27 lines
1.1 KiB
Diff
|
|
qemu-spoof: CPUID leaf 0x15 (TSC / core-crystal ratio)
|
||
|
|
|
||
|
|
Stock QEMU returns 0 for leaf 0x15; real Intel CPUs enumerate the TSC / nominal
|
||
|
|
core-crystal clock ratio. Fill EAX(denominator)/EBX(numerator)/ECX(crystal Hz) from
|
||
|
|
the module so TSC == the leaf-0x16 base frequency (24 MHz crystal * base_mhz / 24).
|
||
|
|
Intel only; the getters return 0 for an AMD persona or when off, matching stock.
|
||
|
|
(spoof.h include in target/i386 is added by 0013.)
|
||
|
|
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
|
||
|
|
index c6fd1dc..aa0dd73 100644
|
||
|
|
--- a/target/i386/cpu.c
|
||
|
|
+++ b/target/i386/cpu.c
|
||
|
|
@@ -8811,6 +8811,14 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
|
||
|
|
}
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
+ case 0x15:
|
||
|
|
+ /* qemu-spoof: TSC / nominal core-crystal ratio (stock QEMU returns 0).
|
||
|
|
+ * The getters return 0 when off or for an AMD persona, matching stock. */
|
||
|
|
+ *eax = (uint32_t)spoof_cpu_tsc_den(0);
|
||
|
|
+ *ebx = (uint32_t)spoof_cpu_tsc_num(0);
|
||
|
|
+ *ecx = (uint32_t)spoof_cpu_crystal_hz(0);
|
||
|
|
+ *edx = 0;
|
||
|
|
+ break;
|
||
|
|
case 0x1C: /* Last Branch Records Information Leaf */
|
||
|
|
*eax = 0;
|
||
|
|
*ebx = 0;
|