This patch emulates CPUID instruction. It should work but when I'm
testing it in kvm-userspace, the cpuid instruction seems to have no
effect (I mean eax == ebx == ecx == edx == 0x0). Should
kvm_cpuid_emulate() be modified? Is cpuid instruction correctly
implemented?

Regards,

Signed-off-by: Guillaume Thouvenin <[email protected]>
---
 arch/x86/kvm/x86_emulate.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
index d174db7..4d1821c 100644
--- a/arch/x86/kvm/x86_emulate.c
+++ b/arch/x86/kvm/x86_emulate.c
@@ -237,7 +237,7 @@ static u32 twobyte_table[256] = {
        /* 0x90 - 0x9F */
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        /* 0xA0 - 0xA7 */
-       0, 0, 0, DstMem | SrcReg | ModRM | BitOp,
+       0, 0, ImplicitOps, DstMem | SrcReg | ModRM | BitOp,
        DstMem | SrcReg | Src2ImmByte | ModRM,
        DstMem | SrcReg | Src2CL | ModRM, 0, 0,
        /* 0xA8 - 0xAF */
@@ -2035,6 +2035,9 @@ twobyte_insn:
                c->dst.type = OP_NONE;
                break;
        }
+       case 0xa2:              /* cpuid */
+               kvm_emulate_cpuid(ctxt->vcpu);
+               break;
        case 0xa3:
              bt:               /* bt */
                c->dst.type = OP_NONE;
-- 
1.6.0.4.623.g171d7

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to