]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
xen: unify pte operations
authorJeremy Fitzhardinge <jeremy@goop.org>
Mon, 17 Mar 2008 23:37:09 +0000 (16:37 -0700)
committerIngo Molnar <mingo@elte.hu>
Thu, 24 Apr 2008 21:57:31 +0000 (23:57 +0200)
We can fold the essentially common pte functions together now.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/xen/mmu.c

index 3148db8e794ee2ec45e70a9f0e12b6818986111a..272635aaef887e0aee36c1038973b4ab393f83e1 100644 (file)
@@ -171,6 +171,49 @@ void xen_set_pte_at(struct mm_struct *mm, unsigned long addr,
        xen_set_pte(ptep, pteval);
 }
 
+pteval_t xen_pte_val(pte_t pte)
+{
+       pteval_t ret = pte.pte;
+
+       if (ret & _PAGE_PRESENT)
+               ret = machine_to_phys(XMADDR(ret)).paddr | _PAGE_PRESENT;
+
+       return ret;
+}
+
+pgdval_t xen_pgd_val(pgd_t pgd)
+{
+       pgdval_t ret = pgd.pgd;
+       if (ret & _PAGE_PRESENT)
+               ret = machine_to_phys(XMADDR(ret)).paddr | _PAGE_PRESENT;
+       return ret;
+}
+
+pte_t xen_make_pte(pteval_t pte)
+{
+       if (pte & _PAGE_PRESENT) {
+               pte = phys_to_machine(XPADDR(pte)).maddr;
+               pte &= ~(_PAGE_PCD | _PAGE_PWT);
+       }
+
+       return (pte_t){ .pte = pte };
+}
+
+pgd_t xen_make_pgd(pgdval_t pgd)
+{
+       if (pgd & _PAGE_PRESENT)
+               pgd = phys_to_machine(XPADDR(pgd)).maddr;
+
+       return (pgd_t){ pgd };
+}
+
+pmdval_t xen_pmd_val(pmd_t pmd)
+{
+       pmdval_t ret = native_pmd_val(pmd);
+       if (ret & _PAGE_PRESENT)
+               ret = machine_to_phys(XMADDR(ret)).paddr | _PAGE_PRESENT;
+       return ret;
+}
 #ifdef CONFIG_X86_PAE
 void xen_set_pud(pud_t *ptr, pud_t val)
 {
@@ -214,98 +257,18 @@ void xen_pmd_clear(pmd_t *pmdp)
        xen_set_pmd(pmdp, __pmd(0));
 }
 
-pteval_t xen_pte_val(pte_t pte)
-{
-       pteval_t ret = pte.pte;
-
-       if (ret & _PAGE_PRESENT)
-               ret = machine_to_phys(XMADDR(ret)).paddr | _PAGE_PRESENT;
-
-       return ret;
-}
-
-pmdval_t xen_pmd_val(pmd_t pmd)
-{
-       pmdval_t ret = pmd.pmd;
-       if (ret & _PAGE_PRESENT)
-               ret = machine_to_phys(XMADDR(ret)).paddr | _PAGE_PRESENT;
-       return ret;
-}
-
-pgdval_t xen_pgd_val(pgd_t pgd)
-{
-       pgdval_t ret = pgd.pgd;
-       if (ret & _PAGE_PRESENT)
-               ret = machine_to_phys(XMADDR(ret)).paddr | _PAGE_PRESENT;
-       return ret;
-}
-
-pte_t xen_make_pte(pteval_t pte)
-{
-       if (pte & _PAGE_PRESENT) {
-               pte = phys_to_machine(XPADDR(pte)).maddr;
-               pte &= ~(_PAGE_PCD | _PAGE_PWT);
-       }
-
-       return (pte_t){ .pte = pte };
-}
-
 pmd_t xen_make_pmd(pmdval_t pmd)
 {
        if (pmd & _PAGE_PRESENT)
                pmd = phys_to_machine(XPADDR(pmd)).maddr;
 
-       return (pmd_t){ pmd };
-}
-
-pgd_t xen_make_pgd(pgdval_t pgd)
-{
-       if (pgd & _PAGE_PRESENT)
-               pgd = phys_to_machine(XPADDR(pgd)).maddr;
-
-       return (pgd_t){ pgd };
+       return native_make_pmd(pmd);
 }
 #else  /* !PAE */
 void xen_set_pte(pte_t *ptep, pte_t pte)
 {
        *ptep = pte;
 }
-
-pteval_t xen_pte_val(pte_t pte)
-{
-       pteval_t ret = pte.pte;
-
-       if (ret & _PAGE_PRESENT)
-               ret = machine_to_phys(XMADDR(ret)).paddr;
-
-       return ret;
-}
-
-pgdval_t xen_pgd_val(pgd_t pgd)
-{
-       pteval_t ret = pgd.pgd;
-       if (ret & _PAGE_PRESENT)
-               ret = machine_to_phys(XMADDR(ret)).paddr | _PAGE_PRESENT;
-       return ret;
-}
-
-pte_t xen_make_pte(pteval_t pte)
-{
-       if (pte & _PAGE_PRESENT) {
-               pte = phys_to_machine(XPADDR(pte)).maddr;
-               pte &= ~(_PAGE_PCD | _PAGE_PWT);
-       }
-
-       return (pte_t){ pte };
-}
-
-pgd_t xen_make_pgd(pgdval_t pgd)
-{
-       if (pgd & _PAGE_PRESENT)
-               pgd = phys_to_machine(XPADDR(pgd)).maddr;
-
-       return (pgd_t){ pgd };
-}
 #endif /* CONFIG_X86_PAE */
 
 /*