From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH 3/7] KVM: x86 emulator: introduce NoWrite flag Date: Sat, 22 Dec 2012 18:20:49 +0200 Message-ID: <20121222162049.GY29007@redhat.com> References: <1356179217-5526-1-git-send-email-avi.kivity@gmail.com> <1356179217-5526-4-git-send-email-avi.kivity@gmail.com> <20121222151111.GW29007@redhat.com> <20121222153934.GX29007@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Marcelo Tosatti , kvm To: Avi Kivity Return-path: Received: from mx1.redhat.com ([209.132.183.28]:22280 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751651Ab2LVQUw (ORCPT ); Sat, 22 Dec 2012 11:20:52 -0500 Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Sat, Dec 22, 2012 at 05:51:08PM +0200, Avi Kivity wrote: > On Sat, Dec 22, 2012 at 5:45 PM, Avi Kivity wrote: > > On Sat, Dec 22, 2012 at 5:39 PM, Gleb Natapov wrote: > >> On Sat, Dec 22, 2012 at 05:28:00PM +0200, Avi Kivity wrote: > >>> On Sat, Dec 22, 2012 at 5:11 PM, Gleb Natapov wrote: > >>> >> #define X2(x...) x, x > >>> >> #define X3(x...) X2(x), x > >>> >> @@ -1584,6 +1585,9 @@ static int writeback(struct x86_emulate_ctxt *ctxt) > >>> >> { > >>> >> int rc; > >>> >> > >>> >> + if (ctxt->d & NoWrite) > >>> >> + return X86EMUL_CONTINUE; > >>> >> + > >>> > Why not make it Dst flag and set dst.type to OP_NONE during decoding > >>> > instead of this special case? > >>> > >>> My thinking was to eventually convert everything to NoWrite, then it's > >>> not a special case. But your approach works too, I can change it if > >>> you like. We'll have an if () either way though. > >> But meanwhile we will have two different ways to disable writeback. When > >> all instructions will be marked with NoWrite we can switch it easily if > >> we want. Also some instruction can disable writeback conditionally. cmov is one > >> (and may be only) of them. > > > > Makes sense, will update for the next iteration. > > Actually that doesn't work. x86_emulate_insn() needs dst.type in order > to fetch the operand. True :(. Actually if we will move from OP_NONE to NoWrite we can drop saved_dst_type hack from x86_emulate_insn. -- Gleb.