]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/xen.git/commitdiff
x86: Use PGC_cacheattr_mask rather than a hardcoded constant.
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 19 May 2009 00:17:16 +0000 (01:17 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 19 May 2009 00:17:16 +0000 (01:17 +0100)
Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
xen/arch/x86/mm.c

index d11c2a1ce4a8a0158507022e9be45fde7db60dba..dce0fbbe1a84fd90a57248728fed45934ed57e2f 100644 (file)
@@ -766,7 +766,7 @@ get_page_from_l1e(
         goto could_not_pin;
 
     if ( pte_flags_to_cacheattr(l1f) !=
-         ((page->count_info >> PGC_cacheattr_base) & 7) )
+         ((page->count_info & PGC_cacheattr_mask) >> PGC_cacheattr_base) )
     {
         unsigned long x, nx, y = page->count_info;
         unsigned long cacheattr = pte_flags_to_cacheattr(l1f);
@@ -782,7 +782,7 @@ get_page_from_l1e(
             return 0;
         }
 
-        while ( ((y >> PGC_cacheattr_base) & 7) != cacheattr )
+        while ( ((y & PGC_cacheattr_mask) >> PGC_cacheattr_base) != cacheattr )
         {
             x  = y;
             nx = (x & ~PGC_cacheattr_mask) | (cacheattr << PGC_cacheattr_base);
@@ -2389,7 +2389,8 @@ int get_page_type_preemptible(struct page_info *page, unsigned long type)
 
 void cleanup_page_cacheattr(struct page_info *page)
 {
-    uint32_t cacheattr = (page->count_info >> PGC_cacheattr_base) & 7;
+    uint32_t cacheattr =
+        (page->count_info & PGC_cacheattr_mask) >> PGC_cacheattr_base;
 
     if ( likely(cacheattr == 0) )
         return;