Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bedbe4ee86195dcd899577828714cc1413beb571
Commit:     bedbe4ee86195dcd899577828714cc1413beb571
Parent:     8d87a03aea43535a92efbb180e0ceac94d4bb5db
Author:     Avi Kivity <[EMAIL PROTECTED]>
AuthorDate: Sun Dec 9 16:52:56 2007 +0200
Committer:  Avi Kivity <[EMAIL PROTECTED]>
CommitDate: Wed Jan 30 17:53:20 2008 +0200

    KVM: MMU: Move pte access calculation into a helper function
    
    Signed-off-by: Avi Kivity <[EMAIL PROTECTED]>
---
 drivers/kvm/paging_tmpl.h |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h
index 59ba752..1fc4f9b 100644
--- a/drivers/kvm/paging_tmpl.h
+++ b/drivers/kvm/paging_tmpl.h
@@ -102,6 +102,18 @@ static bool FNAME(cmpxchg_gpte)(struct kvm *kvm,
        return (ret != orig_pte);
 }
 
+static unsigned FNAME(gpte_access)(struct kvm_vcpu *vcpu, pt_element_t gpte)
+{
+       unsigned access;
+
+       access = (gpte & (PT_WRITABLE_MASK | PT_USER_MASK)) | ACC_EXEC_MASK;
+#if PTTYPE == 64
+       if (is_nx(vcpu))
+               access &= ~(gpte >> PT64_NX_SHIFT);
+#endif
+       return access;
+}
+
 /*
  * Fetch a guest pte for a guest virtual address
  */
@@ -166,13 +178,7 @@ walk:
                        pte |= PT_ACCESSED_MASK;
                }
 
-               pte_access = pte & (PT_WRITABLE_MASK | PT_USER_MASK);
-               pte_access |= ACC_EXEC_MASK;
-#if PTTYPE == 64
-               if (is_nx(vcpu))
-                       pte_access &= ~(pte >> PT64_NX_SHIFT);
-#endif
-               pte_access &= pt_access;
+               pte_access = pt_access & FNAME(gpte_access)(vcpu, pte);
 
                if (walker->level == PT_PAGE_TABLE_LEVEL) {
                        walker->gfn = gpte_to_gfn(pte);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to