From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH UNTESTED] KVM: VMX: Save/restore rflags.vm correctly in real mode Date: Thu, 8 Apr 2010 17:01:06 -0300 Message-ID: <20100408200106.GA25347@amt.cnet> References: <1270739975-25344-1-git-send-email-avi@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mx1.redhat.com ([209.132.183.28]:14414 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933157Ab0DHUnf (ORCPT ); Thu, 8 Apr 2010 16:43:35 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o38KhZMK002604 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 8 Apr 2010 16:43:35 -0400 Content-Disposition: inline In-Reply-To: <1270739975-25344-1-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Apr 08, 2010 at 06:19:35PM +0300, Avi Kivity wrote: > Currently we set eflags.vm unconditionally when entering real mode emulation > through virtual-8086 mode, and clear it unconditionally when we enter protected > mode. The means that the following sequence > > KVM_SET_REGS (rflags.vm=1) > KVM_SET_SREGS (cr0.pe=1) > > Ends up with rflags.vm clear due to KVM_SET_SREGS triggering enter_pmode(). > > Fix by shadowing rflags.vm (and rflags.iopl) correctly while in real mode: > reads and writes to those bits access a shadow register instead of the actual > register. > > Signed-off-by: Avi Kivity Tested and applied, thanks.