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 3/8] KVM: x86 emulator: switch MUL/DIV to DstXacc
Date: Sat,  9 Feb 2013 11:31:46 +0200	[thread overview]
Message-ID: <1360402311-19904-4-git-send-email-avi.kivity@gmail.com> (raw)
In-Reply-To: <1360402311-19904-1-git-send-email-avi.kivity@gmail.com>

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

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index aa8516e..d51f6f4 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -139,6 +139,7 @@
 /* Source 2 operand type */
 #define Src2Shift   (30)
 #define Src2None    (OpNone << Src2Shift)
+#define Src2Mem     (OpMem << Src2Shift)
 #define Src2CL      (OpCL << Src2Shift)
 #define Src2ImmByte (OpImmByte << Src2Shift)
 #define Src2One     (OpOne << Src2Shift)
@@ -542,8 +543,8 @@ FOP_END;
 #define __emulate_1op_rax_rdx(ctxt, _op, _suffix, _ex)			\
 	do {								\
 		unsigned long _tmp;					\
-		ulong *rax = reg_rmw((ctxt), VCPU_REGS_RAX);		\
-		ulong *rdx = reg_rmw((ctxt), VCPU_REGS_RDX);		\
+		ulong *rax = &ctxt->dst.val;				\
+		ulong *rdx = &ctxt->src.val;				\
 									\
 		__asm__ __volatile__ (					\
 			_PRE_EFLAGS("0", "5", "1")			\
@@ -558,7 +559,7 @@ FOP_END;
 			_ASM_EXTABLE(1b, 3b)				\
 			: "=m" ((ctxt)->eflags), "=&r" (_tmp),		\
 			  "+a" (*rax), "+d" (*rdx), "+qm"(_ex)		\
-			: "i" (EFLAGS_MASK), "m" ((ctxt)->src.val));	\
+			: "i" (EFLAGS_MASK), "m" ((ctxt)->src2.val));	\
 	} while (0)
 
 /* instruction has only one source operand, destination is implicit (e.g. mul, div, imul, idiv) */
@@ -3701,10 +3702,10 @@ static const struct opcode group3[] = {
 	F(DstMem | SrcImm | NoWrite, em_test),
 	F(DstMem | SrcNone | Lock, em_not),
 	F(DstMem | SrcNone | Lock, em_neg),
-	I(SrcMem, em_mul_ex),
-	I(SrcMem, em_imul_ex),
-	I(SrcMem, em_div_ex),
-	I(SrcMem, em_idiv_ex),
+	I(DstXacc | Src2Mem, em_mul_ex),
+	I(DstXacc | Src2Mem, em_imul_ex),
+	I(DstXacc | Src2Mem, em_div_ex),
+	I(DstXacc | Src2Mem, em_idiv_ex),
 };
 
 static const struct opcode group4[] = {
-- 
1.8.1.2


  parent reply	other threads:[~2013-02-09  9:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-09  9:31 [PATCH 0/8] Convert MUL/DIV to fastop Avi Kivity
2013-02-09  9:31 ` [PATCH 1/8] KVM: x86 emulator: add support for writing back the source operand Avi Kivity
2013-02-10 11:56   ` Gleb Natapov
2013-02-09  9:31 ` [PATCH 2/8] KVM: x86 emulator: decode extended accumulator explicity Avi Kivity
2013-02-10 12:19   ` Gleb Natapov
2013-05-20 12:32     ` Gleb Natapov
2013-02-09  9:31 ` Avi Kivity [this message]
2013-02-09  9:31 ` [PATCH 4/8] KVM: x86 emulator: Switch fastop src operand to RDX Avi Kivity
2013-02-09  9:31 ` [PATCH 5/8] KVM: x86 emulator: convert single-operand MUL/IMUL to fastop Avi Kivity
2013-02-09  9:31 ` [PATCH 6/8] KVM: x86 emulator: convert DIV/IDIV " Avi Kivity
2013-02-10 12:26   ` Gleb Natapov
2013-02-09  9:31 ` [PATCH 7/8] KVM: x86 emulator: drop unused old-style inline emulation Avi Kivity
2013-02-09  9:31 ` [PATCH 8/8] KVM: x86 emulator: convert XADD to fastop 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=1360402311-19904-4-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