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

[Xen-changelog] [xen-unstable] [XEN] sh_gfn_to_mfn_foreign() must handle guest pfns above 4GB on PAE



# HG changeset patch
# User Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
# Node ID 7df4d8cfba3b2fbd12ac1f287ab854ff4b242721
# Parent  a2618d3912e7be3eb01e1afc116d7f5d5ec209ff
[XEN] sh_gfn_to_mfn_foreign() must handle guest pfns above 4GB on PAE
Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
---
 xen/arch/x86/mm/shadow/common.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff -r a2618d3912e7 -r 7df4d8cfba3b xen/arch/x86/mm/shadow/common.c
--- a/xen/arch/x86/mm/shadow/common.c   Mon Dec 04 19:13:55 2006 +0000
+++ b/xen/arch/x86/mm/shadow/common.c   Tue Dec 05 12:42:29 2006 +0000
@@ -1246,7 +1246,7 @@ sh_gfn_to_mfn_foreign(struct domain *d, 
 /* Read another domain's p2m entries */
 {
     mfn_t mfn;
-    unsigned long addr = gpfn << PAGE_SHIFT;
+    paddr_t addr = ((paddr_t)gpfn) << PAGE_SHIFT;
     l2_pgentry_t *l2e;
     l1_pgentry_t *l1e;
     
@@ -1274,7 +1274,16 @@ sh_gfn_to_mfn_foreign(struct domain *d, 
 #if CONFIG_PAGING_LEVELS >= 3
     {
         l3_pgentry_t *l3e = sh_map_domain_page(mfn);
-        l3e += l3_table_offset(addr);
+#if CONFIG_PAGING_LEVELS == 3
+        /* On PAE hosts the p2m has eight l3 entries, not four (see
+         * shadow_set_p2m_entry()) so we can't use l3_table_offset.
+         * Instead, just count the number of l3es from zero.  It's safe
+         * to do this because we already checked that the gfn is within
+         * the bounds of the p2m. */
+        l3e += (((addr) & VADDR_MASK) >> L3_PAGETABLE_SHIFT);
+#else
+        l3e += l3_table_offset(addr);        
+#endif
         if ( (l3e_get_flags(*l3e) & _PAGE_PRESENT) == 0 )
         {
             sh_unmap_domain_page(l3e);

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


 


Rackspace

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