From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH] KVM: x86 emulator: cleanup for BitOp instruction emulation Date: Wed, 04 Aug 2010 11:26:47 +0200 Message-ID: <4C593257.2090702@redhat.com> References: <4C592470.1010608@cn.fujitsu.com> <4C592C55.8080607@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 7bit Cc: Avi Kivity , kvm@vger.kernel.org To: Wei Yongjun Return-path: Received: from mail-vw0-f46.google.com ([209.85.212.46]:54329 "EHLO mail-vw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755789Ab0HDJaL (ORCPT ); Wed, 4 Aug 2010 05:30:11 -0400 Received: by vws3 with SMTP id 3so3930211vws.19 for ; Wed, 04 Aug 2010 02:30:11 -0700 (PDT) In-Reply-To: <4C592C55.8080607@cn.fujitsu.com> Sender: kvm-owner@vger.kernel.org List-ID: On 08/04/2010 11:01 AM, Wei Yongjun wrote: > 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; > + You are doing this before the destination operand is decoded, which means you are not adjusting a memory operand anymore if c->src.val > (c->op_bytes * 8). Paolo