]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
x86: unify pgtable accessors which use, #2
authorIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:32:57 +0000 (13:32 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:32:57 +0000 (13:32 +0100)
based on:

 Subject: x86: unify pgtable accessors which use supported_pte_mask
 From: Jeremy Fitzhardinge <jeremy@goop.org>

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
include/asm-x86/pgtable.h
include/asm-x86/pgtable_32.h

index b29a122fc1ff5ffec6114ed2cee348d266c4a528..6452286e71a1aafbdf8296f0b96edf54c74170c6 100644 (file)
@@ -155,6 +155,21 @@ static inline pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot)
                      pgprot_val(pgprot)) & __supported_pte_mask);
 }
 
+static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
+{
+       pteval_t val = pte_val(pte);
+
+       /*
+        * Chop off the NX bit (if present), and add the NX portion of
+        * the newprot (if present):
+        */
+       val &= _PAGE_CHG_MASK & ~_PAGE_NX;
+       val |= pgprot_val(newprot) & __supported_pte_mask;
+
+       return __pte(val);
+}
+
+
 #endif /* __ASSEMBLY__ */
 
 #ifdef CONFIG_X86_32
index 0aaefdda5158476ff9d23870b83cb6816bc44415..109dad5e16eeeaebfe33ffe19be618a47036be12 100644 (file)
@@ -235,22 +235,6 @@ static inline void clone_pgd_range(pgd_t *dst, pgd_t *src, int count)
 
 #define mk_pte(page, pgprot)   pfn_pte(page_to_pfn(page), (pgprot))
 
-static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
-{
-       pte.pte_low &= _PAGE_CHG_MASK;
-       pte.pte_low |= pgprot_val(newprot);
-#ifdef CONFIG_X86_PAE
-       /*
-        * Chop off the NX bit (if present), and add the NX portion of
-        * the newprot (if present):
-        */
-       pte.pte_high &= ~(1 << (_PAGE_BIT_NX - 32));
-       pte.pte_high |= (pgprot_val(newprot) >> 32) & \
-                                       (__supported_pte_mask >> 32);
-#endif
-       return pte;
-}
-
 /*
  * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD]
  *