From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 03/14] KVM: x86 emulator: move memop, memopp into emulation context Date: Wed, 14 Sep 2011 14:37:21 +0300 Message-ID: <4E7091F1.4040900@redhat.com> References: <1315899951-2357-1-git-send-email-avi@redhat.com> <1315899951-2357-4-git-send-email-avi@redhat.com> <20110914194144.9d9946cf.yoshikawa.takuya@oss.ntt.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , kvm@vger.kernel.org, takuya.yoshikawa@gmail.com To: Takuya Yoshikawa Return-path: Received: from mx1.redhat.com ([209.132.183.28]:38580 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932129Ab1INLh1 (ORCPT ); Wed, 14 Sep 2011 07:37:27 -0400 In-Reply-To: <20110914194144.9d9946cf.yoshikawa.takuya@oss.ntt.co.jp> Sender: kvm-owner@vger.kernel.org List-ID: On 09/14/2011 01:41 PM, Takuya Yoshikawa wrote: > On Tue, 13 Sep 2011 10:45:40 +0300 > Avi Kivity wrote: > > > Simplifies further generalization of decode. > > > > Signed-off-by: Avi Kivity > > --- > > arch/x86/include/asm/kvm_emulate.h | 2 ++ > > arch/x86/kvm/emulate.c | 34 +++++++++++++++++----------------- > > 2 files changed, 19 insertions(+), 17 deletions(-) > > > > diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h > > index 6040d11..56bac3e 100644 > > --- a/arch/x86/include/asm/kvm_emulate.h > > +++ b/arch/x86/include/asm/kvm_emulate.h > > @@ -275,6 +275,8 @@ struct x86_emulate_ctxt { > > unsigned long _eip; > > /* Fields above regs are cleared together. */ > > unsigned long regs[NR_VCPU_REGS]; > > + struct operand memop; > > + struct operand *memopp; > > struct fetch_cache fetch; > > struct read_cache io_read; > > struct read_cache mem_read; > > Once the emulator context gets stablized, some comments will be nice > to know which ones are supposed to be accessed from outside of the > emulator, and which ones are only for the emulator internal usage. > > Practically, knowing each member's lifetime, decode stage only or > emulation stage only or throughout the emulation, will make it easy > to avoid extra ctxt/regs initialization and ... maybe more. > Nothing should be accessed from outside the emulator, except via accessors. We should move initialization to the emulator as well (or just initialize from x86_decode_insn() - any reason not to?) -- error compiling committee.c: too many arguments to function