[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Questions for the shadow page code



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.