Skip to contentSkip to conversation

Move guest_l*e definitions into common code

PATCH New Tim Deegan 1 participant 1 message Nov 13, 2008

lore
Share & tools
lore

Tim Deegan

author
#0 lore raw

PATCH 1/3 Move guest_l*e definitions into common code

Move the definitions of guest pagetable types and the guest pagetable walk record out of the shadow-code headers into asm-x86.

xen/arch/x86/mm/shadow/multi.c +8 -8
diff -r 47a35046ce9d xen/arch/x86/mm/shadow/multi.c
@@ -35,6 +35,7 @@
 #include <asm/hvm/hvm.h>
 #include <asm/hvm/cacheattr.h>
 #include <asm/mtrr.h>
+#include <asm/guest_pt.h>
 #include "private.h"
 #include "types.h"
 
@@ -254,7 +255,7 @@ static uint32_t set_ad_bits(void *guest_
  * Return 1 to indicate success and 0 for inconsistency
  */
 static inline uint32_t
-shadow_check_gwalk(struct vcpu *v, unsigned long va, walk_t *gw)
+shadow_check_gwalk(struct vcpu *v, unsigned long va, walk_t *gw, int version)
 {
     struct domain *d = v->domain;
     guest_l1e_t *l1p;
@@ -267,9 +268,8 @@ shadow_check_gwalk(struct vcpu *v, unsig
 
     ASSERT(shadow_locked_by_me(d));
 
-    if ( gw->version ==
-         atomic_read(&d->arch.paging.shadow.gtable_dirty_version) )
-        return 1;
+    if ( version == atomic_read(&d->arch.paging.shadow.gtable_dirty_version) )
+         return 1;
 
     /* We may consider caching guest page mapping from last
      * guest table walk. However considering this check happens
@@ -401,9 +401,6 @@ guest_walk_tables(struct vcpu *v, unsign
     perfc_incr(shadow_guest_walk);
     memset(gw, 0, sizeof(*gw));
     gw->va = va;
-
-    gw->version = atomic_read(&d->arch.paging.shadow.gtable_dirty_version);
-    rmb();
 
     /* Mandatory bits that must be set in every entry.  We invert NX, to
      * calculate as if there were an "X" bit that allowed access. 
@@ -3188,6 +3185,7 @@ static int sh_page_fault(struct vcpu *v,
     fetch_type_t ft = 0;
     p2m_type_t p2mt;
     uint32_t rc;
+    int version;
 #if SHADOW_OPTIMIZATIONS & SHOPT_FAST_EMULATION
     int fast_emul = 0;
 #endif
@@ -3331,6 +3329,8 @@ static int sh_page_fault(struct vcpu *v,
     }
 
  rewalk:
+    version = atomic_read(&d->arch.paging.shadow.gtable_dirty_version);
+    rmb();
     rc = guest_walk_tables(v, va, &gw, regs->error_code);
 
 #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
@@ -3407,7 +3407,7 @@ static int sh_page_fault(struct vcpu *v,
     }
 #endif /* OOS */
 
-    if ( !shadow_check_gwalk(v, va, &gw) )
+    if ( !shadow_check_gwalk(v, va, &gw, version) )
     {
         perfc_incr(shadow_inconsistent_gwalk);
         shadow_unlock(d);
xen/arch/x86/mm/shadow/types.h +5 -198

226 lines not on this page · raw message

xen/include/asm-x86/guest_pt.h new file +204 -0

204 lines not on this page · raw message

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