All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guillaume Thouvenin <guillaume.thouvenin@ext.bull.net>
To: kvm@vger.kernel.org
Subject: [RFC PATCH] x86 emulator: emulate CPUID instruction
Date: Mon, 15 Dec 2008 12:43:55 +0100	[thread overview]
Message-ID: <20081215124355.009afdb5@frecb000711> (raw)

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


             reply	other threads:[~2008-12-15 12:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-15 11:43 Guillaume Thouvenin [this message]
2008-12-21 12:11 ` [RFC PATCH] x86 emulator: emulate CPUID instruction Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081215124355.009afdb5@frecb000711 \
    --to=guillaume.thouvenin@ext.bull.net \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.