diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-11-16 03:40:36 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-12-22 06:05:35 -0500 |
commit | 36bb94ba36f332de767cfaa3af6a5136435a3a9c (patch) | |
tree | 45d1bd890b58658f4db58a033e619e511e3368f4 /arch/arm/include/asm/pgtable.h | |
parent | 9522d7e4cb5e0858122fc55d33a2c07728f0b10d (diff) |
ARM: pgtable: provide RDONLY page table bit rather than WRITE bit
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/include/asm/pgtable.h')
-rw-r--r-- | arch/arm/include/asm/pgtable.h | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h index f9b3f4bd7410..ebcb6432f45f 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h | |||
@@ -169,7 +169,7 @@ extern void __pgd_error(const char *file, int line, pgd_t); | |||
169 | #define L_PTE_YOUNG (_AT(pteval_t, 1) << 1) | 169 | #define L_PTE_YOUNG (_AT(pteval_t, 1) << 1) |
170 | #define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */ | 170 | #define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */ |
171 | #define L_PTE_DIRTY (_AT(pteval_t, 1) << 6) | 171 | #define L_PTE_DIRTY (_AT(pteval_t, 1) << 6) |
172 | #define L_PTE_WRITE (_AT(pteval_t, 1) << 7) | 172 | #define L_PTE_RDONLY (_AT(pteval_t, 1) << 7) |
173 | #define L_PTE_USER (_AT(pteval_t, 1) << 8) | 173 | #define L_PTE_USER (_AT(pteval_t, 1) << 8) |
174 | #define L_PTE_XN (_AT(pteval_t, 1) << 9) | 174 | #define L_PTE_XN (_AT(pteval_t, 1) << 9) |
175 | #define L_PTE_SHARED (_AT(pteval_t, 1) << 10) /* shared(v6), coherent(xsc3) */ | 175 | #define L_PTE_SHARED (_AT(pteval_t, 1) << 10) /* shared(v6), coherent(xsc3) */ |
@@ -205,23 +205,23 @@ extern pgprot_t pgprot_kernel; | |||
205 | 205 | ||
206 | #define _MOD_PROT(p, b) __pgprot(pgprot_val(p) | (b)) | 206 | #define _MOD_PROT(p, b) __pgprot(pgprot_val(p) | (b)) |
207 | 207 | ||
208 | #define PAGE_NONE _MOD_PROT(pgprot_user, L_PTE_XN) | 208 | #define PAGE_NONE _MOD_PROT(pgprot_user, L_PTE_XN | L_PTE_RDONLY) |
209 | #define PAGE_SHARED _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_WRITE | L_PTE_XN) | 209 | #define PAGE_SHARED _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_XN) |
210 | #define PAGE_SHARED_EXEC _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_WRITE) | 210 | #define PAGE_SHARED_EXEC _MOD_PROT(pgprot_user, L_PTE_USER) |
211 | #define PAGE_COPY _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_XN) | 211 | #define PAGE_COPY _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_RDONLY | L_PTE_XN) |
212 | #define PAGE_COPY_EXEC _MOD_PROT(pgprot_user, L_PTE_USER) | 212 | #define PAGE_COPY_EXEC _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_RDONLY) |
213 | #define PAGE_READONLY _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_XN) | 213 | #define PAGE_READONLY _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_RDONLY | L_PTE_XN) |
214 | #define PAGE_READONLY_EXEC _MOD_PROT(pgprot_user, L_PTE_USER) | 214 | #define PAGE_READONLY_EXEC _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_RDONLY) |
215 | #define PAGE_KERNEL _MOD_PROT(pgprot_kernel, L_PTE_XN) | 215 | #define PAGE_KERNEL _MOD_PROT(pgprot_kernel, L_PTE_XN) |
216 | #define PAGE_KERNEL_EXEC pgprot_kernel | 216 | #define PAGE_KERNEL_EXEC pgprot_kernel |
217 | 217 | ||
218 | #define __PAGE_NONE __pgprot(_L_PTE_DEFAULT | L_PTE_XN) | 218 | #define __PAGE_NONE __pgprot(_L_PTE_DEFAULT | L_PTE_RDONLY | L_PTE_XN) |
219 | #define __PAGE_SHARED __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_WRITE | L_PTE_XN) | 219 | #define __PAGE_SHARED __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_XN) |
220 | #define __PAGE_SHARED_EXEC __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_WRITE) | 220 | #define __PAGE_SHARED_EXEC __pgprot(_L_PTE_DEFAULT | L_PTE_USER) |
221 | #define __PAGE_COPY __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_XN) | 221 | #define __PAGE_COPY __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_RDONLY | L_PTE_XN) |
222 | #define __PAGE_COPY_EXEC __pgprot(_L_PTE_DEFAULT | L_PTE_USER) | 222 | #define __PAGE_COPY_EXEC __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_RDONLY) |
223 | #define __PAGE_READONLY __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_XN) | 223 | #define __PAGE_READONLY __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_RDONLY | L_PTE_XN) |
224 | #define __PAGE_READONLY_EXEC __pgprot(_L_PTE_DEFAULT | L_PTE_USER) | 224 | #define __PAGE_READONLY_EXEC __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_RDONLY) |
225 | 225 | ||
226 | #define __pgprot_modify(prot,mask,bits) \ | 226 | #define __pgprot_modify(prot,mask,bits) \ |
227 | __pgprot((pgprot_val(prot) & ~(mask)) | (bits)) | 227 | __pgprot((pgprot_val(prot) & ~(mask)) | (bits)) |
@@ -380,7 +380,7 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, | |||
380 | 380 | ||
381 | #define pte_none(pte) (!pte_val(pte)) | 381 | #define pte_none(pte) (!pte_val(pte)) |
382 | #define pte_present(pte) (pte_val(pte) & L_PTE_PRESENT) | 382 | #define pte_present(pte) (pte_val(pte) & L_PTE_PRESENT) |
383 | #define pte_write(pte) (pte_val(pte) & L_PTE_WRITE) | 383 | #define pte_write(pte) (!(pte_val(pte) & L_PTE_RDONLY)) |
384 | #define pte_dirty(pte) (pte_val(pte) & L_PTE_DIRTY) | 384 | #define pte_dirty(pte) (pte_val(pte) & L_PTE_DIRTY) |
385 | #define pte_young(pte) (pte_val(pte) & L_PTE_YOUNG) | 385 | #define pte_young(pte) (pte_val(pte) & L_PTE_YOUNG) |
386 | #define pte_exec(pte) (!(pte_val(pte) & L_PTE_XN)) | 386 | #define pte_exec(pte) (!(pte_val(pte) & L_PTE_XN)) |
@@ -393,8 +393,8 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, | |||
393 | #define PTE_BIT_FUNC(fn,op) \ | 393 | #define PTE_BIT_FUNC(fn,op) \ |
394 | static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; } | 394 | static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; } |
395 | 395 | ||
396 | PTE_BIT_FUNC(wrprotect, &= ~L_PTE_WRITE); | 396 | PTE_BIT_FUNC(wrprotect, |= L_PTE_RDONLY); |
397 | PTE_BIT_FUNC(mkwrite, |= L_PTE_WRITE); | 397 | PTE_BIT_FUNC(mkwrite, &= ~L_PTE_RDONLY); |
398 | PTE_BIT_FUNC(mkclean, &= ~L_PTE_DIRTY); | 398 | PTE_BIT_FUNC(mkclean, &= ~L_PTE_DIRTY); |
399 | PTE_BIT_FUNC(mkdirty, |= L_PTE_DIRTY); | 399 | PTE_BIT_FUNC(mkdirty, |= L_PTE_DIRTY); |
400 | PTE_BIT_FUNC(mkold, &= ~L_PTE_YOUNG); | 400 | PTE_BIT_FUNC(mkold, &= ~L_PTE_YOUNG); |
@@ -404,7 +404,7 @@ static inline pte_t pte_mkspecial(pte_t pte) { return pte; } | |||
404 | 404 | ||
405 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | 405 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) |
406 | { | 406 | { |
407 | const pteval_t mask = L_PTE_XN | L_PTE_WRITE | L_PTE_USER; | 407 | const pteval_t mask = L_PTE_XN | L_PTE_RDONLY | L_PTE_USER; |
408 | pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask); | 408 | pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask); |
409 | return pte; | 409 | return pte; |
410 | } | 410 | } |