All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] x86 emulator: emulate CPUID instruction
@ 2008-12-15 11:43 Guillaume Thouvenin
  2008-12-21 12:11 ` Avi Kivity
  0 siblings, 1 reply; 2+ messages in thread
From: Guillaume Thouvenin @ 2008-12-15 11:43 UTC (permalink / raw)
  To: kvm

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 <guillaume.thouvenin@ext.bull.net>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-12-21 12:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-15 11:43 [RFC PATCH] x86 emulator: emulate CPUID instruction Guillaume Thouvenin
2008-12-21 12:11 ` Avi Kivity

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.