From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Yongjun Subject: [PATCH] KVM: x86 emulator: cleanup for BitOp instruction emulation Date: Wed, 04 Aug 2010 17:01:09 +0800 Message-ID: <4C592C55.8080607@cn.fujitsu.com> References: <4C592470.1010608@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from cn.fujitsu.com ([222.73.24.84]:54732 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1756209Ab0HDJDJ (ORCPT ); Wed, 4 Aug 2010 05:03:09 -0400 In-Reply-To: <4C592470.1010608@cn.fujitsu.com> Sender: kvm-owner@vger.kernel.org List-ID: Signed-off-by: Wei Yongjun --- arch/x86/kvm/emulate.c | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index eba5a67..c05a5d7 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -2545,6 +2545,10 @@ done_prefixes: break; } + /* Only subword offset for BitOp: bt/bts/btr/btc. */ + if (c->d & BitOp) + c->src.val &= (c->op_bytes << 3) - 1; + /* * Decode and fetch the second source operand: register, memory * or immediate. @@ -3303,8 +3307,6 @@ twobyte_insn: case 0xa3: bt: /* bt */ c->dst.type = OP_NONE; - /* only subword offset */ - c->src.val &= (c->dst.bytes << 3) - 1; emulate_2op_SrcV_nobyte("bt", c->src, c->dst, ctxt->eflags); break; case 0xa4: /* shld imm8, r, r/m */ @@ -3321,8 +3323,6 @@ twobyte_insn: break; case 0xab: bts: /* bts */ - /* only subword offset */ - c->src.val &= (c->dst.bytes << 3) - 1; emulate_2op_SrcV_nobyte("bts", c->src, c->dst, ctxt->eflags); break; case 0xac: /* shrd imm8, r, r/m */ @@ -3350,8 +3350,6 @@ twobyte_insn: break; case 0xb3: btr: /* btr */ - /* only subword offset */ - c->src.val &= (c->dst.bytes << 3) - 1; emulate_2op_SrcV_nobyte("btr", c->src, c->dst, ctxt->eflags); break; case 0xb6 ... 0xb7: /* movzx */ @@ -3373,8 +3371,6 @@ twobyte_insn: break; case 0xbb: btc: /* btc */ - /* only subword offset */ - c->src.val &= (c->dst.bytes << 3) - 1; emulate_2op_SrcV_nobyte("btc", c->src, c->dst, ctxt->eflags); break; case 0xbe ... 0xbf: /* movsx */ -- 1.7.0.4