From mboxrd@z Thu Jan 1 00:00:00 1970 From: Borislav Petkov Subject: Re: [PATCH -v2] kvm: Emulate MOVBE Date: Mon, 22 Apr 2013 15:49:45 +0200 Message-ID: <20130422134945.GA4412@pd.tnic> References: <20130414084303.GE17919@redhat.com> <20130414210218.GF20547@pd.tnic> <516D37A0.2070706@redhat.com> <20130421114649.GC4594@pd.tnic> <20130421122321.GD4594@pd.tnic> <5174FA96.1040807@redhat.com> <20130422093810.GC4637@pd.tnic> <20130422094246.GN8997@redhat.com> <20130422095203.GE4637@pd.tnic> <20130422095812.GB6027@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: Paolo Bonzini , Andre Przywara , kvm@vger.kernel.org, =?utf-8?B?SsO2cmcgUsO2ZGVs?= , "H. Peter Anvin" , x86-ml To: Gleb Natapov Return-path: Received: from mail.skyhub.de ([78.46.96.112]:50083 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751931Ab3DVNts (ORCPT ); Mon, 22 Apr 2013 09:49:48 -0400 Content-Disposition: inline In-Reply-To: <20130422095812.GB6027@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Apr 22, 2013 at 12:58:12PM +0300, Gleb Natapov wrote: > For most instructions the decoder already sets op->bytes to correct > value, given that all flags a correctly specified in opcode table. > Explicit op->bytes setting should be done only if it cannot be > expressed by opcode flags. MOVBE encodes operands in ModRM and operand size is determined by the effective operand size. By looking at that switch(mode) thing near the beginning of x86_decode_insn, we make sure ctxt->op_bytes is set accordingly. Then, we have the following definitions for MOVBE: + [0xf0] = I(DstReg | SrcMem | ModRM | Mov | ThreeByte | EmulateOnUD, em_movbe), + [0xf1] = I(DstMem | SrcReg | ModRM | Mov | ThreeByte | EmulateOnUD, em_movbe), and from looking at decode_operand(), it makes sure that op->bytes gets the correct value since we have the proper {Src,Dst}{Reg,Mem} flags in the insn definition. So everything is fine, I'll make sure it works that way too, though, when testing. Thanks. -- Regards/Gruss, Boris. Sent from a fat crate under my desk. Formatting is fine. --