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] Questions for the shadow page code

To: Yao <yffbrave@xxxxxxx>
Subject: Re: [Xen-devel] Questions for the shadow page code
From: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Date: Fri, 11 Mar 2011 09:19:11 +0000
Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 11 Mar 2011 01:19:39 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <53223977.4c0f.12ea2c48806.Coremail.yffbrave@xxxxxxx>
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>
References: <53223977.4c0f.12ea2c48806.Coremail.yffbrave@xxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.20 (2009-06-14)
Hi, 

At 02:35 +0000 on 11 Mar (1299810912), Yao wrote:
> If the GuestOS is 32-bit, then shadow_get_and_create_l1e should execute
> {
>     *sl2mfn = pagetable_get_mfn(v->arch.shadow_table[0]);
> 
>     (void) shadow_l2_index(sl2mfn, guest_l2_table_offset(gw->va));
> 
>     return sh_linear_l2_table(v) + shadow_l2_linear_offset(gw->va);
> }
> 1.How does the Xen organize the spt? it looks like xen used 36-bit pae
> for spt, but how does it correspond to the guest 2 level page table?

Yes.  The shadow page tables _must_ be PAE or 64-bit in order to be able
to use machine memory >4GiB for VMs.  From the comments in shadow/common.c:

 * A 32-bit guest l1 table covers 4MB
 * of virtual address space, and needs to be shadowed by two PAE/64-bit
 * l1 tables (covering 2MB of virtual address space each).  Similarly, a
 * 32-bit guest l2 table (4GB va) needs to be shadowed by four
 * PAE/64-bit l2 tables (1GB va each).  These multi-page shadows are
 * not contiguous in memory; functions for handling offsets into them are
 * defined in shadow/multi.c (shadow_l1_index() etc.)

> 2.What's the function of sh_linear_l2_table & the whole return
> sentence? It's the same situation in the shadow_get_and_cr eate_l2e.

sh_linear_l2_table is a linear mapping of the _shadow_ pagetables.
Xen's pagetables have two linear mappings in them - one of the
pagetables you're running on (__linear_l1_table &c in page.h) and one of
the current VCPU's shadow pagetables (__sh_linear_l1_table &c in
types.h).  sh_linear_l*_table is a macro that mixes those appropriately
to generate the address where a shadow PTE will be visible.

> There are some assemble code and it screw me up :(
>
> 3.Are there any docs to help me to figure it out?

Sorry, there's only the code and the mailing list archives. 

Cheers,

Tim.

-- 
Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Principal Software Engineer, Xen Platform Team
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)

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

<Prev in Thread] Current Thread [Next in Thread>