From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [RFC] Getting correct eip in skip_emulated_instruction() Date: Wed, 22 Oct 2008 12:09:48 +0200 Message-ID: <48FEFBEC.1020101@redhat.com> References: <20081021154327.11939162@frecb000711> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm , Mohammed Gamal To: Guillaume Thouvenin Return-path: Received: from mx2.redhat.com ([66.187.237.31]:36960 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756698AbYJVKKZ (ORCPT ); Wed, 22 Oct 2008 06:10:25 -0400 In-Reply-To: <20081021154327.11939162@frecb000711> Sender: kvm-owner@vger.kernel.org List-ID: Guillaume Thouvenin wrote: > Hello, > > Presently when we want to skip an emulated instruction we update the > eip by reading the instruction length from VMCS structure and we add > this value to the current eip. It gives us the new eip. A problem occurs > when the guest state doesn't allow us to use VT because in that case, > the values in VMCS structure are not up to date. That means that if we > call skip_emulated_instruction() while guest state is invalid, the > computed eip will be false. > > To fix the problem I introduced a new field in the structure kvm_io to > store the eip value if guest state is invalid. If the stored value is > equal to 0 we read the length of the current instruction in VMCS and if > not, we use it as the new eip. It works but I'm not really happy with > that hack and I don't see how to solve the problem nicely. > If we call the emulator we shouldn't call skip_emulated_instruction() in the first place, since the emulator already computes the next rip for us. I suggest moving ->skip_emulated_instruction() out of kvm_emulate_pio() and into handle_io() (and the svm equivalent). -- error compiling committee.c: too many arguments to function