]> xenbits.xensource.com Git - people/vhanquez/xen.git/commitdiff
[HVM] Fix shadow mode to not corrupt frame 0's page_info struct.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 31 May 2006 06:32:04 +0000 (07:32 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 31 May 2006 06:32:04 +0000 (07:32 +0100)
Signed-off-by: Jun Nakajima <jun.nakajima@intel.com>
xen-unstable changeset:   10189:ec1e371ec3208f771595da6c82baae4cd9a441f5
xen-unstable date:        Wed May 31 07:25:59 2006 +0100

xen/arch/x86/shadow.c
xen/arch/x86/shadow32.c
xen/include/asm-x86/shadow.h

index 30bc21c51aeb34152b2db585da687808298d8ba7..1be664d43303a2ef16f7db617995c26619d90545 100644 (file)
@@ -1688,7 +1688,8 @@ static int resync_all(struct domain *d, u32 stype)
                         unshadow_l1 = 1;
                     else {
                         need_flush |= error;
-                        set_guest_back_ptr(d, *sl1e_p, smfn, i);
+                        if ( l1e_get_flags(*sl1e_p) & _PAGE_PRESENT )
+                            set_guest_back_ptr(d, *sl1e_p, smfn, i);
                     }
                     // can't update snapshots of linear page tables -- they
                     // are used multiple times...
index ae2f5a5ad9a53e7be246af679227e8638bb0318b..8f60fbbc2c0957fc490b28f58e140fc1475d0f85 100644 (file)
@@ -2678,7 +2678,8 @@ static int resync_all(struct domain *d, u32 stype)
                         unshadow_l1 = 1;
                     else {
                         need_flush |= error;
-                        set_guest_back_ptr(d, shadow1[i], smfn, i);
+                        if ( l1e_get_flags(shadow1[i]) & _PAGE_PRESENT )
+                            set_guest_back_ptr(d, shadow1[i], smfn, i);
                     }
 
                     // can't update snapshots of linear page tables -- they
index 28d50466ea004519cdfcb2710db3af2797242419..3a9e0cdf84ee7d492049e4a2c0495153dd68a5fc 100644 (file)
@@ -762,10 +762,16 @@ static inline void set_guest_back_ptr(
         unsigned long gmfn;
 
         ASSERT(shadow_lock_is_acquired(d));
+        ASSERT( smfn );
         gmfn = l1e_get_pfn(spte);
-        mfn_to_page(gmfn)->tlbflush_timestamp = smfn;
-        mfn_to_page(gmfn)->u.inuse.type_info &= ~PGT_va_mask;
-        mfn_to_page(gmfn)->u.inuse.type_info |= (unsigned long) index << PGT_va_shift;
+        ASSERT( gmfn );
+        if ( l1e_get_flags(spte) & _PAGE_RW )
+        {
+            mfn_to_page(gmfn)->tlbflush_timestamp = smfn;
+            mfn_to_page(gmfn)->u.inuse.type_info &= ~PGT_va_mask;
+            mfn_to_page(gmfn)->u.inuse.type_info |= 
+                (unsigned long) index << PGT_va_shift;
+        }
     }
 }