From patchwork Wed Mar 3 02:29:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 83241 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o232eln7020944 for ; Wed, 3 Mar 2010 02:40:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753426Ab0CCCkp (ORCPT ); Tue, 2 Mar 2010 21:40:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:19124 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753293Ab0CCCko (ORCPT ); Tue, 2 Mar 2010 21:40:44 -0500 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o232eeXp005748 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 2 Mar 2010 21:40:40 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o232edG5025295; Tue, 2 Mar 2010 21:40:39 -0500 Received: from amt.cnet (vpn-8-198.rdu.redhat.com [10.11.8.198]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o232ebB9010706; Tue, 2 Mar 2010 21:40:38 -0500 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 66AE368A799; Tue, 2 Mar 2010 23:29:12 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id o232TAWJ021132; Tue, 2 Mar 2010 23:29:10 -0300 Date: Tue, 2 Mar 2010 23:29:10 -0300 From: Marcelo Tosatti To: Jan Kiszka Cc: Avi Kivity , kvm@vger.kernel.org, qemu-devel@nongnu.org Subject: Re: [PATCH 2/4] KVM: Rework VCPU state writeback API Message-ID: <20100303022910.GA21054@amt.cnet> References: <2257cac7474705fc35d74fcdff0566fb7dc0770e.1267467030.git.jan.kiszka@siemens.com> <20100302001415.GA22627@amt.cnet> <4B8CC584.1060106@web.de> <20100302115531.GA19713@amt.cnet> <4B8D3D4D.8080601@siemens.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4B8D3D4D.8080601@siemens.com> User-Agent: Mutt/1.5.20 (2009-08-17) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 03 Mar 2010 02:40:47 +0000 (UTC) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 14873b9..898173a 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -1822,13 +1822,23 @@ static u64 vmx_get_segment_base(struct kvm_vcpu *vcpu, int seg) static void vmx_get_segment(struct kvm_vcpu *vcpu, struct kvm_segment *var, int seg) { + struct vcpu_vmx *vmx = to_vmx(vcpu); struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg]; u32 ar; + if (vmx->rmode.vm86_active && seg == VCPU_SREG_TR) { + var->base = vmx->rmode.tr.base; + var->limit = vmx->rmode.tr.limit; + var->selector = vmx->rmode.tr.selector; + ar = vmx->rmode.tr.ar; + goto ar; + } + var->base = vmcs_readl(sf->base); var->limit = vmcs_read32(sf->limit); var->selector = vmcs_read16(sf->selector); ar = vmcs_read32(sf->ar_bytes); +ar: if ((ar & AR_UNUSABLE_MASK) && !emulate_invalid_guest_state) ar = 0; var->type = ar & 15;