[Xen-changelog] [xen-unstable] [XEN] [TOOLS] 32on64 compat save/restore: unadjust L3E flags at save time

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Xen-changelog] [xen-unstable] [XEN] [TOOLS] 32on64 compat save/restore: unadjust L3E flags at save time

Xen patchbot-unstable
# HG changeset patch
# User Emmanuel Ackaouy <[hidden email]>
# Date 1172235500 0
# Node ID 8bcaedc68f5a0ba773d789f45f7ec578cd7d7c76
# Parent  cdc765772f692f2e8cf53cdada703adac24e5af0
[XEN] [TOOLS] 32on64 compat save/restore: unadjust L3E flags at save time
Get rid of USER|RW|ACCESSED L3 PTE flags which may be present
in a PAE guest when running on a 64bit hypervisor at save time.
This prevents the restore operation from getting confused by
these flags.
Reset disallowed L3E flags to match PAE case.

Signed-off-by: Emmanuel Ackaouy <[hidden email]>
---
 tools/libxc/xc_linux_save.c       |   12 ++++++++++++
 xen/include/asm-x86/x86_64/page.h |    2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff -r cdc765772f69 -r 8bcaedc68f5a tools/libxc/xc_linux_save.c
--- a/tools/libxc/xc_linux_save.c Fri Feb 23 11:32:25 2007 +0000
+++ b/tools/libxc/xc_linux_save.c Fri Feb 23 12:58:20 2007 +0000
@@ -543,6 +543,18 @@ static int canonicalize_pagetable(unsign
 
             pte &= ~MADDR_MASK_X86;
             pte |= (uint64_t)pfn << PAGE_SHIFT;
+
+            /*
+             * PAE guest L3Es can contain these flags when running on
+             * a 64bit hypervisor. We zap these here to avoid any
+             * surprise at restore time...
+             */
+            if ( pt_levels == 3 &&
+                 type == XEN_DOMCTL_PFINFO_L3TAB &&
+                 pte & (_PAGE_USER|_PAGE_RW|_PAGE_ACCESSED) )
+            {
+                pte &= ~(_PAGE_USER|_PAGE_RW|_PAGE_ACCESSED);
+            }
         }
 
         if (pt_levels == 2)
diff -r cdc765772f69 -r 8bcaedc68f5a xen/include/asm-x86/x86_64/page.h
--- a/xen/include/asm-x86/x86_64/page.h Fri Feb 23 11:32:25 2007 +0000
+++ b/xen/include/asm-x86/x86_64/page.h Fri Feb 23 12:58:20 2007 +0000
@@ -98,7 +98,7 @@ typedef l4_pgentry_t root_pgentry_t;
 #define L3_DISALLOW_MASK (BASE_DISALLOW_MASK)
 #define L4_DISALLOW_MASK (BASE_DISALLOW_MASK)
 
-#define COMPAT_L3_DISALLOW_MASK L3_DISALLOW_MASK
+#define COMPAT_L3_DISALLOW_MASK 0xFFFFF1E6U
 
 #define PAGE_HYPERVISOR         (__PAGE_HYPERVISOR         | _PAGE_GLOBAL)
 #define PAGE_HYPERVISOR_NOCACHE (__PAGE_HYPERVISOR_NOCACHE | _PAGE_GLOBAL)

_______________________________________________
Xen-changelog mailing list
[hidden email]
http://lists.xensource.com/xen-changelog