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

[Xen-changelog] [HVM] Fix set_guest_back_ptr to ignore empty PTEs.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxxxx
# Node ID 121ec8b952d33a358e6c6ab65493e0b47e56781d
# Parent  09d9d6e7b9851cfb2206395ced55b4769e164b4a
[HVM] Fix set_guest_back_ptr to ignore empty PTEs.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/include/asm-x86/shadow.h |   37 ++++++++++++++++++++-----------------
 1 files changed, 20 insertions(+), 17 deletions(-)

diff -r 09d9d6e7b985 -r 121ec8b952d3 xen/include/asm-x86/shadow.h
--- a/xen/include/asm-x86/shadow.h      Thu Jun 01 10:34:21 2006 +0100
+++ b/xen/include/asm-x86/shadow.h      Thu Jun 01 10:50:33 2006 +0100
@@ -756,23 +756,26 @@ shadow_unpin(unsigned long smfn)
  * when working on finer-gained locks for shadow.
  */
 static inline void set_guest_back_ptr(
-    struct domain *d, l1_pgentry_t spte, unsigned long smfn, unsigned int 
index)
-{
-    if ( shadow_mode_external(d) ) {
-        unsigned long gmfn;
-
-        ASSERT(shadow_lock_is_acquired(d));
-        ASSERT( smfn );
-        gmfn = l1e_get_pfn(spte);
-        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;
-        }
-    }
+    struct domain *d, l1_pgentry_t spte,
+    unsigned long smfn, unsigned int index)
+{
+    struct page_info *gpage;
+
+    ASSERT(shadow_lock_is_acquired(d));
+
+    if ( !shadow_mode_external(d) || 
+         ((l1e_get_flags(spte) & (_PAGE_PRESENT|_PAGE_RW)) !=
+          (_PAGE_PRESENT|_PAGE_RW)) )
+        return;
+
+    gpage = l1e_get_page(spte);
+
+    ASSERT(smfn != 0);
+    ASSERT(page_to_mfn(gpage) != 0);
+
+    gpage->tlbflush_timestamp = smfn;
+    gpage->u.inuse.type_info &= ~PGT_va_mask;
+    gpage->u.inuse.type_info |= (unsigned long)index << PGT_va_shift;
 }
 
 /************************************************************************/

_______________________________________________
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®.