From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [RFC PATCH 3/4] KVM: x86: add support for emulating UMIP Date: Wed, 13 Jul 2016 22:03:22 +0200 Message-ID: <20160713200321.GA16130@potion> References: <1468351223-3250-1-git-send-email-pbonzini@redhat.com> <1468351223-3250-4-git-send-email-pbonzini@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org To: Paolo Bonzini Return-path: Received: from mx1.redhat.com ([209.132.183.28]:49504 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750933AbcGMUDa (ORCPT ); Wed, 13 Jul 2016 16:03:30 -0400 Content-Disposition: inline In-Reply-To: <1468351223-3250-4-git-send-email-pbonzini@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 2016-07-12 21:20+0200, Paolo Bonzini: > Signed-off-by: Paolo Bonzini > --- > diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c > @@ -3738,6 +3747,10 @@ static int em_lidt(struct x86_emulate_ctxt *ctxt) > > static int em_smsw(struct x86_emulate_ctxt *ctxt) > { > + if ((ctxt->ops->get_cr(ctxt, 4) & X86_CR4_UMIP) && > + ctxt->ops->cpl(ctxt) > 0) UMIP should #GP(0) in virtual-8086 mode too (for SMSW, SIDT, and SGDT), but cpl() returns 0 in vm86. > + return emulate_gp(ctxt, 0);