Skip to contentSkip to conversation

kvm-unit-test: fix cpuid test

PATCH In review Gleb Natapov 2 participants 2 messages Nov 4, 2013 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm-unit-test: fix cpuid test

If cpuid is called with function value greater than max supported one max supported value is used instead and index parameter is honored. That is why we need to initialize index to same value in the test to get same result from both cpuid invocations.

x86/realmode.c +1 -0
index c57e033..0e1cd37 100644
@@ -1375,6 +1375,7 @@ static void test_cpuid(void)
     unsigned eax, ebx, ecx, edx;
 
     inregs.eax = eax = function;
+    inregs.ecx = ecx = 0;
     asm("cpuid" : "+a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx));
     exec_in_big_real_mode(&insn_cpuid);
     report("cpuid", R_AX|R_BX|R_CX|R_DX,

--
Gleb.

maintainer Reviewed-by on v1 1/1
#1 lore raw

Il 04/11/2013 15:04, Gleb Natapov ha scritto:

Quoted 18 lines

If cpuid is called with function value greater than max supported one max supported value is used instead and index parameter is honored. That is why we need to initialize index to same value in the test to get same result from both cpuid invocations.

x86/realmode.c +1 -1
index c57e033..0e1cd37 100644
@@ -1375,6 +1375,7 @@ static void test_cpuid(void)
     unsigned eax, ebx, ecx, edx;
 
     inregs.eax = eax = function;
+    inregs.ecx = ecx = 0;
     asm("cpuid" : "+a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx));
     exec_in_big_real_mode(&insn_cpuid);
     report("cpuid", R_AX|R_BX|R_CX|R_DX,
--
Quoted 2 lines

Gleb.