When CPUID_EXT_MONITOR is not set, it means no support of MONITOR/MWAIT
leaf, i.e., CPUID leaf 5.
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
target/i386/cpu.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 03376ccf3e75..5bee84333089 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6553,10 +6553,14 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
break;
case 5:
/* MONITOR/MWAIT Leaf */
- *eax = cpu->mwait.eax; /* Smallest monitor-line size in bytes */
- *ebx = cpu->mwait.ebx; /* Largest monitor-line size in bytes */
- *ecx = cpu->mwait.ecx; /* flags */
- *edx = cpu->mwait.edx; /* mwait substates */
+ if (env->features[FEAT_1_ECX] & CPUID_EXT_MONITOR) {
+ *eax = cpu->mwait.eax; /* Smallest monitor-line size in bytes */
+ *ebx = cpu->mwait.ebx; /* Largest monitor-line size in bytes */
+ *ecx = cpu->mwait.ecx; /* flags */
+ *edx = cpu->mwait.edx; /* mwait substates */
+ } else {
+ *eax = *ebx = *ecx = *edx = 0;
+ }
break;
case 6:
/* Thermal and Power Leaf */
--
2.34.1