diff options
-rw-r--r-- | include/asm-x86/pgtable.h | 15 | ||||
-rw-r--r-- | include/asm-x86/pgtable_32.h | 16 |
2 files changed, 15 insertions, 16 deletions
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h index b29a122fc1ff..6452286e71a1 100644 --- a/include/asm-x86/pgtable.h +++ b/include/asm-x86/pgtable.h | |||
@@ -155,6 +155,21 @@ static inline pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot) | |||
155 | pgprot_val(pgprot)) & __supported_pte_mask); | 155 | pgprot_val(pgprot)) & __supported_pte_mask); |
156 | } | 156 | } |
157 | 157 | ||
158 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | ||
159 | { | ||
160 | pteval_t val = pte_val(pte); | ||
161 | |||
162 | /* | ||
163 | * Chop off the NX bit (if present), and add the NX portion of | ||
164 | * the newprot (if present): | ||
165 | */ | ||
166 | val &= _PAGE_CHG_MASK & ~_PAGE_NX; | ||
167 | val |= pgprot_val(newprot) & __supported_pte_mask; | ||
168 | |||
169 | return __pte(val); | ||
170 | } | ||
171 | |||
172 | |||
158 | #endif /* __ASSEMBLY__ */ | 173 | #endif /* __ASSEMBLY__ */ |
159 | 174 | ||
160 | #ifdef CONFIG_X86_32 | 175 | #ifdef CONFIG_X86_32 |
diff --git a/include/asm-x86/pgtable_32.h b/include/asm-x86/pgtable_32.h index 0aaefdda5158..109dad5e16ee 100644 --- a/include/asm-x86/pgtable_32.h +++ b/include/asm-x86/pgtable_32.h | |||
@@ -235,22 +235,6 @@ static inline void clone_pgd_range(pgd_t *dst, pgd_t *src, int count) | |||
235 | 235 | ||
236 | #define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) | 236 | #define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) |
237 | 237 | ||
238 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | ||
239 | { | ||
240 | pte.pte_low &= _PAGE_CHG_MASK; | ||
241 | pte.pte_low |= pgprot_val(newprot); | ||
242 | #ifdef CONFIG_X86_PAE | ||
243 | /* | ||
244 | * Chop off the NX bit (if present), and add the NX portion of | ||
245 | * the newprot (if present): | ||
246 | */ | ||
247 | pte.pte_high &= ~(1 << (_PAGE_BIT_NX - 32)); | ||
248 | pte.pte_high |= (pgprot_val(newprot) >> 32) & \ | ||
249 | (__supported_pte_mask >> 32); | ||
250 | #endif | ||
251 | return pte; | ||
252 | } | ||
253 | |||
254 | /* | 238 | /* |
255 | * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD] | 239 | * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD] |
256 | * | 240 | * |