diff options
Diffstat (limited to 'arch/arm/include/asm/pgtable.h')
-rw-r--r-- | arch/arm/include/asm/pgtable.h | 62 |
1 files changed, 51 insertions, 11 deletions
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h index 3b30062975b2..d5cac545ba33 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h | |||
@@ -252,17 +252,57 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, | |||
252 | set_pte_ext(ptep, pteval, ext); | 252 | set_pte_ext(ptep, pteval, ext); |
253 | } | 253 | } |
254 | 254 | ||
255 | #define PTE_BIT_FUNC(fn,op) \ | 255 | static inline pte_t clear_pte_bit(pte_t pte, pgprot_t prot) |
256 | static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; } | 256 | { |
257 | 257 | pte_val(pte) &= ~pgprot_val(prot); | |
258 | PTE_BIT_FUNC(wrprotect, |= L_PTE_RDONLY); | 258 | return pte; |
259 | PTE_BIT_FUNC(mkwrite, &= ~L_PTE_RDONLY); | 259 | } |
260 | PTE_BIT_FUNC(mkclean, &= ~L_PTE_DIRTY); | 260 | |
261 | PTE_BIT_FUNC(mkdirty, |= L_PTE_DIRTY); | 261 | static inline pte_t set_pte_bit(pte_t pte, pgprot_t prot) |
262 | PTE_BIT_FUNC(mkold, &= ~L_PTE_YOUNG); | 262 | { |
263 | PTE_BIT_FUNC(mkyoung, |= L_PTE_YOUNG); | 263 | pte_val(pte) |= pgprot_val(prot); |
264 | PTE_BIT_FUNC(mkexec, &= ~L_PTE_XN); | 264 | return pte; |
265 | PTE_BIT_FUNC(mknexec, |= L_PTE_XN); | 265 | } |
266 | |||
267 | static inline pte_t pte_wrprotect(pte_t pte) | ||
268 | { | ||
269 | return set_pte_bit(pte, __pgprot(L_PTE_RDONLY)); | ||
270 | } | ||
271 | |||
272 | static inline pte_t pte_mkwrite(pte_t pte) | ||
273 | { | ||
274 | return clear_pte_bit(pte, __pgprot(L_PTE_RDONLY)); | ||
275 | } | ||
276 | |||
277 | static inline pte_t pte_mkclean(pte_t pte) | ||
278 | { | ||
279 | return clear_pte_bit(pte, __pgprot(L_PTE_DIRTY)); | ||
280 | } | ||
281 | |||
282 | static inline pte_t pte_mkdirty(pte_t pte) | ||
283 | { | ||
284 | return set_pte_bit(pte, __pgprot(L_PTE_DIRTY)); | ||
285 | } | ||
286 | |||
287 | static inline pte_t pte_mkold(pte_t pte) | ||
288 | { | ||
289 | return clear_pte_bit(pte, __pgprot(L_PTE_YOUNG)); | ||
290 | } | ||
291 | |||
292 | static inline pte_t pte_mkyoung(pte_t pte) | ||
293 | { | ||
294 | return set_pte_bit(pte, __pgprot(L_PTE_YOUNG)); | ||
295 | } | ||
296 | |||
297 | static inline pte_t pte_mkexec(pte_t pte) | ||
298 | { | ||
299 | return clear_pte_bit(pte, __pgprot(L_PTE_XN)); | ||
300 | } | ||
301 | |||
302 | static inline pte_t pte_mknexec(pte_t pte) | ||
303 | { | ||
304 | return set_pte_bit(pte, __pgprot(L_PTE_XN)); | ||
305 | } | ||
266 | 306 | ||
267 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | 307 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) |
268 | { | 308 | { |