From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH 3/3] KVM: x86 emulator: get rid of "restart" in emulation context. Date: Tue, 24 Aug 2010 16:52:55 +0300 Message-ID: <20100824135255.GD10499@redhat.com> References: <1282649455-9463-1-git-send-email-gleb@redhat.com> <1282649455-9463-3-git-send-email-gleb@redhat.com> <4C73C582.6050704@redhat.com> <20100824133754.GC10499@redhat.com> <4C73CBF6.1050809@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: mtosatti@redhat.com, kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mx1.redhat.com ([209.132.183.28]:8104 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752802Ab0HXNw5 (ORCPT ); Tue, 24 Aug 2010 09:52:57 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o7ODqv2J008004 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 24 Aug 2010 09:52:57 -0400 Content-Disposition: inline In-Reply-To: <4C73CBF6.1050809@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Aug 24, 2010 at 04:41:10PM +0300, Avi Kivity wrote: > On 08/24/2010 04:37 PM, Gleb Natapov wrote: > >On Tue, Aug 24, 2010 at 04:13:38PM +0300, Avi Kivity wrote: > >> On 08/24/2010 02:30 PM, Gleb Natapov wrote: > >>>x86_emulate_insn() will return 1 if instruction can be restarted > >>>without re-entering a guest. > >>> > >>So now we have an undocumented -1/0/1 return code? > >> > >>Better to have an enum for this. > >> > >We already have two. First is X86EMUL_ (not enum but close) for > >more or less internal emulator use. Second is EMULATE_* for users of > >emulate_instruction() now you want one more enum for communication > >between emulate_instruction() and x86_emulate_insn(). Lost in enums. > >emulate_instruction() and x86_emulate_insn() are tightly coupled right > >now should we define formal interface between them? May be comment will > >be enough? > > Can we reuse one or the other? Perhaps with extensions? > We can, of course. But for me it looks as arbitrary as -1/0/1 since not all enum values have meanings to the caller. -- Gleb.