From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrea Arcangeli Subject: Re: [PATCH][RESEND] x86_emulator: Emulate cld and std instruction Date: Thu, 31 Jul 2008 20:16:47 +0200 Message-ID: <20080731181647.GI11494@duo.random> References: <20080730212727.GA7708@mohd-laptop> <48918C6C.1000408@qumranet.com> <52d4a3890807310325r208b7943h89df5490e2af0131@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Avi Kivity , kvm@vger.kernel.org, riel@surriel.com To: Mohammed Gamal Return-path: Received: from host36-195-149-62.serverdedicati.aruba.it ([62.149.195.36]:42240 "EHLO mx.cpushare.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752840AbYGaSQ5 (ORCPT ); Thu, 31 Jul 2008 14:16:57 -0400 Content-Disposition: inline In-Reply-To: <52d4a3890807310325r208b7943h89df5490e2af0131@mail.gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Jul 31, 2008 at 01:25:40PM +0300, Mohammed Gamal wrote: > The only check was if CS RPL equals SS RPL, so what happens is that > when a vmexit and then a vmentry occurs CS and SS RPL maybe equal, but Yes same problem here, vmentry fails because CS is set to >16 bit value (I think) but the last two bits of CS and SS are the same. That surely is the wrong check to know if we've to invoke emulation on vmentry failure. > other checks might cause a vmentry failure. I've written a function to > check that guest state is VMX valid - although not all checks are > implemented yet, and I no more get the occasional vmexits. Can you send me your latest patch so I can test. I tried to force unconditional emulation on invalid guest state exception generated by vmentry failure but even emulation fails for me, and then your patch sets SS to sane value but that's meaningless here as it's CS that is set to >16bit value. I've yet to trace where emulation fails, but I suspect it's fetching instructions from the wrong place by not emulating the segment-caches set by protected mode, maybe not.