[PATCH 4/9] i386/cpu: Construct valid CPUID leaf 5 iff CPUID_EXT_MONITOR

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux