public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi.kivity@gmail.com>
To: Gleb Natapov <gleb@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm@vger.kernel.org
Subject: [PATCH 6/8] KVM: x86 emulator: convert 2-operand IMUL to fastop
Date: Sat, 12 Jan 2013 16:32:55 +0200	[thread overview]
Message-ID: <1358001177-8952-7-git-send-email-avi.kivity@gmail.com> (raw)
In-Reply-To: <1358001177-8952-1-git-send-email-avi.kivity@gmail.com>

Signed-off-by: Avi Kivity <avi.kivity@gmail.com>
---
 arch/x86/kvm/emulate.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 7ff83d9..c7578d0 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -441,6 +441,8 @@ static void invalidate_registers(struct x86_emulate_ctxt *ctxt)
 		}							\
 	} while (0)
 
+static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *));
+
 #define FOP_ALIGN ".align " __stringify(FASTOP_SIZE) " \n\t"
 #define FOP_RET   "ret \n\t"
 
@@ -3051,6 +3053,8 @@ FASTOP2(test);
 FASTOP3WCL(shld);
 FASTOP3WCL(shrd);
 
+FASTOP2W(imul);
+
 static int em_xchg(struct x86_emulate_ctxt *ctxt)
 {
 	/* Write back the register source. */
@@ -3063,16 +3067,10 @@ static int em_xchg(struct x86_emulate_ctxt *ctxt)
 	return X86EMUL_CONTINUE;
 }
 
-static int em_imul(struct x86_emulate_ctxt *ctxt)
-{
-	emulate_2op_SrcV_nobyte(ctxt, "imul");
-	return X86EMUL_CONTINUE;
-}
-
 static int em_imul_3op(struct x86_emulate_ctxt *ctxt)
 {
 	ctxt->dst.val = ctxt->src2.val;
-	return em_imul(ctxt);
+	return fastop(ctxt, em_imul);
 }
 
 static int em_cwd(struct x86_emulate_ctxt *ctxt)
@@ -4010,7 +4008,7 @@ static const struct opcode twobyte_table[256] = {
 	F(DstMem | SrcReg | ModRM | BitOp | Lock | PageTable, em_bts),
 	F(DstMem | SrcReg | Src2ImmByte | ModRM, em_shrd),
 	F(DstMem | SrcReg | Src2CL | ModRM, em_shrd),
-	D(ModRM), I(DstReg | SrcMem | ModRM, em_imul),
+	D(ModRM), F(DstReg | SrcMem | ModRM, em_imul),
 	/* 0xB0 - 0xB7 */
 	I2bv(DstMem | SrcReg | ModRM | Lock | PageTable, em_cmpxchg),
 	I(DstReg | SrcMemFAddr | ModRM | Src2SS, em_lseg),
-- 
1.8.0.1


  parent reply	other threads:[~2013-01-12 14:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-12 14:32 [PATCH 0/8] More fastop patches Avi Kivity
2013-01-12 14:32 ` [PATCH 1/8] KVM: x86 emulator: Streamline SHLD, SHRD Avi Kivity
2013-01-17  8:45   ` Gleb Natapov
2013-01-12 14:32 ` [PATCH 2/8] KVM: x86 emulator: convert shift/rotate instructions to fastop Avi Kivity
2013-01-12 14:32 ` [PATCH 3/8] KVM: x86 emulator: covert SETCC " Avi Kivity
2013-01-17  9:42   ` Gleb Natapov
2013-01-12 14:32 ` [PATCH 4/8] KVM: x86 emulator: convert INC/DEC " Avi Kivity
2013-01-12 14:32 ` [PATCH 5/8] KVM: x86 emulator: convert BT/BTS/BTR/BTC/BSF/BSR " Avi Kivity
2013-01-12 14:32 ` Avi Kivity [this message]
2013-01-12 14:32 ` [PATCH 7/8] KVM: x86 emulator: rearrange fastop definitions Avi Kivity
2013-01-12 14:32 ` [PATCH 8/8] KVM: x86 emulator: convert a few freestanding emulations to fastop Avi Kivity
2013-01-17  9:44   ` Gleb Natapov

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=1358001177-8952-7-git-send-email-avi.kivity@gmail.com \
    --to=avi.kivity@gmail.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox