WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Re: Manual differ from source code about Unrestricted Gu

To: confucius <henanwxr@xxxxxxxxxxx>
Subject: Re: [Xen-devel] Re: Manual differ from source code about Unrestricted Guest
From: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Date: Wed, 8 Jun 2011 09:08:52 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 08 Jun 2011 01:10:05 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1307509318197-4466268.post@xxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Citrix Systems, Inc.
References: <1307461264749-4462113.post@xxxxxxxxxxxxx> <1307463598.775.655.camel@xxxxxxxxxxxxxxxxxxxxxx> <1307509318197-4466268.post@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Wed, 2011-06-08 at 06:01 +0100, confucius wrote:
> Thank you, Ian and Tim.
> But I am still blurry about Ian's explain, as follow:
> "AIUI although the guest is in unpaged mode the _host_ is not and 
> therefore a pagetable is required from somewhere."

Please bear in mind that I'm not an expert in this area. I might be
talking rubbish...
 
> I konw the host is set to paging and protected mode, so the host(VMM) need a
> page table itself.But identity map table is pointed by GUEST_CR3, not by
> HOST_CR3.

GUEST_CR3 is the CR3 which the processor actually runs on when in guest
(non-root) mode. However this is not necessarily the same as what the
guest sees when it reads its CR3 register -- that read can be emulated
(see hvm_mov_from_cr) when the guest visible and GUEST_CR3 state do not
match. See vmx_update_guest_cr() where we enable/disable
CPU_BASED_CR3_{LOAD,STORE}_EXITING (i.e. emulated cr3 accesses) as
required by the guest current mode.

Similarly for other CRx, i.e. GUEST_CR0 will (on the older VMX
processors as Tim points out) contain CR0.PG=1 while what the guest
reads from cr0 when it believes it isn't in paged mode will be CR0.PG=0.

Ian.

>  The follow is:
>  xen-4.0/arch/x86/hvm/vmx/vmx.c 
> 
> static void vmx_update_guest_cr(...)
> {
> ....
> switch ( cr )
>     { 
>  case 0: ....
>  case 2: ....
>  case 3: 
>     if ( paging_mode_hap(v->domain) )
>         {
>             if ( !hvm_paging_enabled(v) )
>                 v->arch.hvm_vcpu.hw_cr[3] =
>                     v->domain->arch.hvm_domain.params[HVM_PARAM_IDENT_PT];
>             vmx_load_pdptrs(v);
>         }
>  
>         __vmwrite(GUEST_CR3, v->arch.hvm_vcpu.hw_cr[3]);
>         hvm_asid_flush_vcpu(v);
>         break;
> 
> }
> 
> }
> 
> >From such codes, I found GUEST_CR3 not HOST_CR3 point to the identity map
> table with unpaged mode,
> so I am confused by Ian's explain.
> 
> 
> --
> View this message in context: 
> http://xen.1045712.n5.nabble.com/Manual-differ-from-source-code-about-Unrestricted-Guest-tp4462113p4466268.html
> Sent from the Xen - Dev mailing list archive at Nabble.com.
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel