The CPUID instruction takes the value of ECX as an input parameter in addition to the value of EAX for function 4. Make sure we pass the value to the instruction.
Signed-off-by: Amit Shah <amit.s...@redhat.com> --- qemu/target-i386/helper.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/qemu/target-i386/helper.c b/qemu/target-i386/helper.c index cda0390..e468366 100644 --- a/qemu/target-i386/helper.c +++ b/qemu/target-i386/helper.c @@ -1387,7 +1387,7 @@ static void host_cpuid(uint32_t function, uint32_t *eax, uint32_t *ebx, asm volatile("cpuid" : "=a"(vec[0]), "=b"(vec[1]), "=c"(vec[2]), "=d"(vec[3]) - : "0"(function) : "cc"); + : "0"(function), "c"(*ecx) : "cc"); #else asm volatile("pusha \n\t" "cpuid \n\t" @@ -1396,7 +1396,7 @@ static void host_cpuid(uint32_t function, uint32_t *eax, uint32_t *ebx, "mov %%ecx, 8(%1) \n\t" "mov %%edx, 12(%1) \n\t" "popa" - : : "a"(function), "S"(vec) + : : "a"(function), "c"(*ecx), "S"(vec) : "memory", "cc"); #endif @@ -1483,7 +1483,6 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, *edx = 0; break; } - break; case 5: /* mwait info: needed for Core compatibility */ @@ -1526,9 +1525,9 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, *edx = env->cpuid_ext2_features; if (kvm_enabled()) { - uint32_t h_eax, h_edx; + uint32_t h_eax, h_edx, h_ecx; - host_cpuid(0x80000001, &h_eax, NULL, NULL, &h_edx); + host_cpuid(0x80000001, &h_eax, NULL, &h_ecx, &h_edx); /* disable CPU features that the host does not support */ -- 1.6.0.6 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html