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 v2 1/8] KVM: x86 emulator: Convert SHLD, SHRD to fastop
Date: Sat, 19 Jan 2013 19:51:50 +0200 [thread overview]
Message-ID: <1358617917-2076-2-git-send-email-avi.kivity@gmail.com> (raw)
In-Reply-To: <1358617917-2076-1-git-send-email-avi.kivity@gmail.com>
Signed-off-by: Avi Kivity <avi.kivity@gmail.com>
---
arch/x86/kvm/emulate.c | 33 +++++++++++++++++++++------------
1 file changed, 21 insertions(+), 12 deletions(-)
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 619a33d..a21773f 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -454,6 +454,8 @@ static void invalidate_registers(struct x86_emulate_ctxt *ctxt)
#define FOP_END \
".popsection")
+#define FOPNOP() FOP_ALIGN FOP_RET
+
#define FOP1E(op, dst) \
FOP_ALIGN #op " %" #dst " \n\t" FOP_RET
@@ -476,6 +478,18 @@ static void invalidate_registers(struct x86_emulate_ctxt *ctxt)
ON64(FOP2E(op##q, rax, rbx)) \
FOP_END
+#define FOP3E(op, dst, src, src2) \
+ FOP_ALIGN #op " %" #src2 ", %" #src ", %" #dst " \n\t" FOP_RET
+
+/* 3-operand, word-only, src2=cl */
+#define FASTOP3WCL(op) \
+ FOP_START(op) \
+ FOPNOP() \
+ FOP3E(op##w, ax, bx, cl) \
+ FOP3E(op##l, eax, ebx, cl) \
+ ON64(FOP3E(op##q, rax, rbx, cl)) \
+ FOP_END
+
#define __emulate_1op_rax_rdx(ctxt, _op, _suffix, _ex) \
do { \
unsigned long _tmp; \
@@ -3036,6 +3050,9 @@ FASTOP2(xor);
FASTOP2(cmp);
FASTOP2(test);
+FASTOP3WCL(shld);
+FASTOP3WCL(shrd);
+
static int em_xchg(struct x86_emulate_ctxt *ctxt)
{
/* Write back the register source. */
@@ -4015,14 +4032,14 @@ static const struct opcode twobyte_table[256] = {
/* 0xA0 - 0xA7 */
I(Stack | Src2FS, em_push_sreg), I(Stack | Src2FS, em_pop_sreg),
II(ImplicitOps, em_cpuid, cpuid), I(DstMem | SrcReg | ModRM | BitOp, em_bt),
- D(DstMem | SrcReg | Src2ImmByte | ModRM),
- D(DstMem | SrcReg | Src2CL | ModRM), N, N,
+ F(DstMem | SrcReg | Src2ImmByte | ModRM, em_shld),
+ F(DstMem | SrcReg | Src2CL | ModRM, em_shld), N, N,
/* 0xA8 - 0xAF */
I(Stack | Src2GS, em_push_sreg), I(Stack | Src2GS, em_pop_sreg),
DI(ImplicitOps, rsm),
I(DstMem | SrcReg | ModRM | BitOp | Lock | PageTable, em_bts),
- D(DstMem | SrcReg | Src2ImmByte | ModRM),
- D(DstMem | SrcReg | Src2CL | ModRM),
+ F(DstMem | SrcReg | Src2ImmByte | ModRM, em_shrd),
+ F(DstMem | SrcReg | Src2CL | ModRM, em_shrd),
D(ModRM), I(DstReg | SrcMem | ModRM, em_imul),
/* 0xB0 - 0xB7 */
I2bv(DstMem | SrcReg | ModRM | Lock | PageTable, em_cmpxchg),
@@ -4834,14 +4851,6 @@ twobyte_insn:
case 0x90 ... 0x9f: /* setcc r/m8 */
ctxt->dst.val = test_cc(ctxt->b, ctxt->eflags);
break;
- case 0xa4: /* shld imm8, r, r/m */
- case 0xa5: /* shld cl, r, r/m */
- emulate_2op_cl(ctxt, "shld");
- break;
- case 0xac: /* shrd imm8, r, r/m */
- case 0xad: /* shrd cl, r, r/m */
- emulate_2op_cl(ctxt, "shrd");
- break;
case 0xae: /* clflush */
break;
case 0xb6 ... 0xb7: /* movzx */
--
1.8.0.2
next prev parent reply other threads:[~2013-01-19 17:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-19 17:51 [PATCH v2 0/8] More fastop patches Avi Kivity
2013-01-19 17:51 ` Avi Kivity [this message]
2013-01-19 17:51 ` [PATCH v2 2/8] KVM: x86 emulator: convert shift/rotate instructions to fastop Avi Kivity
2013-01-19 17:51 ` [PATCH v2 3/8] KVM: x86 emulator: covert SETCC " Avi Kivity
2013-01-19 17:51 ` [PATCH v2 4/8] KVM: x86 emulator: convert INC/DEC " Avi Kivity
2013-01-19 17:51 ` [PATCH v2 5/8] KVM: x86 emulator: convert BT/BTS/BTR/BTC/BSF/BSR " Avi Kivity
2013-01-19 17:51 ` [PATCH v2 6/8] KVM: x86 emulator: convert 2-operand IMUL " Avi Kivity
2013-01-19 17:51 ` [PATCH v2 7/8] KVM: x86 emulator: rearrange fastop definitions Avi Kivity
2013-01-19 17:51 ` [PATCH v2 8/8] KVM: x86 emulator: convert a few freestanding emulations to fastop Avi Kivity
2013-01-23 0:21 ` Marcelo Tosatti
2013-01-23 8:59 ` Avi Kivity
2013-01-20 10:56 ` [PATCH v2 0/8] More fastop patches 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=1358617917-2076-2-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 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.