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

[Xen-changelog] [xen-unstable] [XEN] Remove VALID_MFN(); replace uses with mfn_valid().



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 93e657836d070b38a8e10d2e241b298787eae304
# Parent  445db3980f61c7eaf613abb5763ac3416be1a28d
[XEN] Remove VALID_MFN(); replace uses with mfn_valid().
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/hvm/svm/svm.c   |    6 +++---
 xen/arch/x86/hvm/vmx/vmx.c   |    8 ++++----
 xen/arch/x86/mm.c            |    6 +++---
 xen/include/asm-x86/mm.h     |    2 --
 xen/include/asm-x86/shadow.h |    4 ++--
 5 files changed, 12 insertions(+), 14 deletions(-)

diff -r 445db3980f61 -r 93e657836d07 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Mon Nov 27 14:52:41 2006 +0000
+++ b/xen/arch/x86/hvm/svm/svm.c        Mon Nov 27 17:48:24 2006 +0000
@@ -1457,7 +1457,7 @@ static int svm_set_cr0(unsigned long val
     {
         /* The guest CR3 must be pointing to the guest physical. */
         mfn = get_mfn_from_gpfn(v->arch.hvm_svm.cpu_cr3 >> PAGE_SHIFT);
-        if ( !VALID_MFN(mfn) || !get_page(mfn_to_page(mfn), v->domain))
+        if ( !mfn_valid(mfn) || !get_page(mfn_to_page(mfn), v->domain))
         {
             gdprintk(XENLOG_ERR, "Invalid CR3 value = %lx (mfn=%lx)\n", 
                      v->arch.hvm_svm.cpu_cr3, mfn);
@@ -1642,7 +1642,7 @@ static int mov_to_cr(int gpreg, int cr, 
              */
             HVM_DBG_LOG(DBG_LEVEL_VMMU, "CR3 value = %lx", value);
             mfn = get_mfn_from_gpfn(value >> PAGE_SHIFT);
-            if ( !VALID_MFN(mfn) || !get_page(mfn_to_page(mfn), v->domain))
+            if ( !mfn_valid(mfn) || !get_page(mfn_to_page(mfn), v->domain))
                 goto bad_cr3;
 
             old_base_mfn = pagetable_get_pfn(v->arch.guest_table);
@@ -1672,7 +1672,7 @@ static int mov_to_cr(int gpreg, int cr, 
 #if CONFIG_PAGING_LEVELS >= 3
                 unsigned long mfn, old_base_mfn;
                 mfn = get_mfn_from_gpfn(v->arch.hvm_svm.cpu_cr3 >> PAGE_SHIFT);
-                if ( !VALID_MFN(mfn) || 
+                if ( !mfn_valid(mfn) || 
                      !get_page(mfn_to_page(mfn), v->domain) )
                     goto bad_cr3;
 
diff -r 445db3980f61 -r 93e657836d07 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Mon Nov 27 14:52:41 2006 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Mon Nov 27 17:48:24 2006 +0000
@@ -1203,7 +1203,7 @@ static int vmx_world_restore(struct vcpu
          */
         HVM_DBG_LOG(DBG_LEVEL_VMMU, "CR3 c->cr3 = %x", c->cr3);
         mfn = get_mfn_from_gpfn(c->cr3 >> PAGE_SHIFT);
-        if ( !VALID_MFN(mfn) || !get_page(mfn_to_page(mfn), v->domain) )
+        if ( !mfn_valid(mfn) || !get_page(mfn_to_page(mfn), v->domain) )
             goto bad_cr3;
         old_base_mfn = pagetable_get_pfn(v->arch.guest_table);
         v->arch.guest_table = pagetable_from_pfn(mfn);
@@ -1389,7 +1389,7 @@ static int vmx_set_cr0(unsigned long val
          * The guest CR3 must be pointing to the guest physical.
          */
         mfn = get_mfn_from_gpfn(v->arch.hvm_vmx.cpu_cr3 >> PAGE_SHIFT);
-        if ( !VALID_MFN(mfn) || !get_page(mfn_to_page(mfn), v->domain) )
+        if ( !mfn_valid(mfn) || !get_page(mfn_to_page(mfn), v->domain) )
         {
             gdprintk(XENLOG_ERR, "Invalid CR3 value = %lx (mfn=%lx)\n",
                      v->arch.hvm_vmx.cpu_cr3, mfn);
@@ -1599,7 +1599,7 @@ static int mov_to_cr(int gp, int cr, str
              */
             HVM_DBG_LOG(DBG_LEVEL_VMMU, "CR3 value = %lx", value);
             mfn = get_mfn_from_gpfn(value >> PAGE_SHIFT);
-            if ( !VALID_MFN(mfn) || !get_page(mfn_to_page(mfn), v->domain) )
+            if ( !mfn_valid(mfn) || !get_page(mfn_to_page(mfn), v->domain) )
                 goto bad_cr3;
             old_base_mfn = pagetable_get_pfn(v->arch.guest_table);
             v->arch.guest_table = pagetable_from_pfn(mfn);
@@ -1627,7 +1627,7 @@ static int mov_to_cr(int gp, int cr, str
 #if CONFIG_PAGING_LEVELS >= 3
                 unsigned long mfn, old_base_mfn;
                 mfn = get_mfn_from_gpfn(v->arch.hvm_vmx.cpu_cr3 >> PAGE_SHIFT);
-                if ( !VALID_MFN(mfn) ||
+                if ( !mfn_valid(mfn) ||
                      !get_page(mfn_to_page(mfn), v->domain) )
                     goto bad_cr3;
 
diff -r 445db3980f61 -r 93e657836d07 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Mon Nov 27 14:52:41 2006 +0000
+++ b/xen/arch/x86/mm.c Mon Nov 27 17:48:24 2006 +0000
@@ -431,7 +431,7 @@ int map_ldt_shadow_page(unsigned int off
 
     gmfn = l1e_get_pfn(l1e);
     mfn = gmfn_to_mfn(d, gmfn);
-    if ( unlikely(!VALID_MFN(mfn)) )
+    if ( unlikely(!mfn_valid(mfn)) )
         return 0;
 
     okay = get_page_and_type(mfn_to_page(mfn), d, PGT_ldt_page);
@@ -2847,8 +2847,8 @@ long do_update_descriptor(u64 pa, u64 de
 
     LOCK_BIGLOCK(dom);
 
-    if ( !VALID_MFN(mfn = gmfn_to_mfn(dom, gmfn)) ||
-         (((unsigned int)pa % sizeof(struct desc_struct)) != 0) ||
+    mfn = gmfn_to_mfn(dom, gmfn);
+    if ( (((unsigned int)pa % sizeof(struct desc_struct)) != 0) ||
          !mfn_valid(mfn) ||
          !check_descriptor(&d) )
     {
diff -r 445db3980f61 -r 93e657836d07 xen/include/asm-x86/mm.h
--- a/xen/include/asm-x86/mm.h  Mon Nov 27 14:52:41 2006 +0000
+++ b/xen/include/asm-x86/mm.h  Mon Nov 27 17:48:24 2006 +0000
@@ -269,8 +269,6 @@ int check_descriptor(struct desc_struct 
 #define gmfn_to_mfn(_d, gpfn)  mfn_x(sh_gfn_to_mfn(_d, gpfn))
 
 #define INVALID_MFN             (~0UL)
-#define VALID_MFN(_mfn)         (!((_mfn) & (1U<<31)))
-
 
 #ifdef MEMORY_GUARD
 void memguard_init(void);
diff -r 445db3980f61 -r 93e657836d07 xen/include/asm-x86/shadow.h
--- a/xen/include/asm-x86/shadow.h      Mon Nov 27 14:52:41 2006 +0000
+++ b/xen/include/asm-x86/shadow.h      Mon Nov 27 17:48:24 2006 +0000
@@ -218,7 +218,7 @@ static inline int
 static inline int
 valid_mfn(mfn_t m)
 {
-    return VALID_MFN(mfn_x(m));
+    return mfn_valid(mfn_x(m));
 }
 
 static inline mfn_t
@@ -665,7 +665,7 @@ mmio_space(paddr_t gpa)
 mmio_space(paddr_t gpa)
 {
     unsigned long gfn = gpa >> PAGE_SHIFT;    
-    return !VALID_MFN(mfn_x(sh_gfn_to_mfn_current(gfn)));
+    return !mfn_valid(mfn_x(sh_gfn_to_mfn_current(gfn)));
 }
 
 static inline l1_pgentry_t

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