diff options
Diffstat (limited to 'arch/arm/include/asm/pgtable.h')
-rw-r--r-- | arch/arm/include/asm/pgtable.h | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h index f66626d71e7d..41dc31f834c3 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h | |||
@@ -195,6 +195,18 @@ static inline pte_t *pmd_page_vaddr(pmd_t pmd) | |||
195 | 195 | ||
196 | #define pte_clear(mm,addr,ptep) set_pte_ext(ptep, __pte(0), 0) | 196 | #define pte_clear(mm,addr,ptep) set_pte_ext(ptep, __pte(0), 0) |
197 | 197 | ||
198 | #define pte_none(pte) (!pte_val(pte)) | ||
199 | #define pte_present(pte) (pte_val(pte) & L_PTE_PRESENT) | ||
200 | #define pte_write(pte) (!(pte_val(pte) & L_PTE_RDONLY)) | ||
201 | #define pte_dirty(pte) (pte_val(pte) & L_PTE_DIRTY) | ||
202 | #define pte_young(pte) (pte_val(pte) & L_PTE_YOUNG) | ||
203 | #define pte_exec(pte) (!(pte_val(pte) & L_PTE_XN)) | ||
204 | #define pte_special(pte) (0) | ||
205 | |||
206 | #define pte_present_user(pte) \ | ||
207 | ((pte_val(pte) & (L_PTE_PRESENT | L_PTE_USER)) == \ | ||
208 | (L_PTE_PRESENT | L_PTE_USER)) | ||
209 | |||
198 | #if __LINUX_ARM_ARCH__ < 6 | 210 | #if __LINUX_ARM_ARCH__ < 6 |
199 | static inline void __sync_icache_dcache(pte_t pteval) | 211 | static inline void __sync_icache_dcache(pte_t pteval) |
200 | { | 212 | { |
@@ -206,25 +218,15 @@ extern void __sync_icache_dcache(pte_t pteval); | |||
206 | static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, | 218 | static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, |
207 | pte_t *ptep, pte_t pteval) | 219 | pte_t *ptep, pte_t pteval) |
208 | { | 220 | { |
209 | if (addr >= TASK_SIZE) | 221 | unsigned long ext = 0; |
210 | set_pte_ext(ptep, pteval, 0); | 222 | |
211 | else { | 223 | if (addr < TASK_SIZE && pte_present_user(pteval)) { |
212 | __sync_icache_dcache(pteval); | 224 | __sync_icache_dcache(pteval); |
213 | set_pte_ext(ptep, pteval, PTE_EXT_NG); | 225 | ext |= PTE_EXT_NG; |
214 | } | 226 | } |
215 | } | ||
216 | 227 | ||
217 | #define pte_none(pte) (!pte_val(pte)) | 228 | set_pte_ext(ptep, pteval, ext); |
218 | #define pte_present(pte) (pte_val(pte) & L_PTE_PRESENT) | 229 | } |
219 | #define pte_write(pte) (!(pte_val(pte) & L_PTE_RDONLY)) | ||
220 | #define pte_dirty(pte) (pte_val(pte) & L_PTE_DIRTY) | ||
221 | #define pte_young(pte) (pte_val(pte) & L_PTE_YOUNG) | ||
222 | #define pte_exec(pte) (!(pte_val(pte) & L_PTE_XN)) | ||
223 | #define pte_special(pte) (0) | ||
224 | |||
225 | #define pte_present_user(pte) \ | ||
226 | ((pte_val(pte) & (L_PTE_PRESENT | L_PTE_USER)) == \ | ||
227 | (L_PTE_PRESENT | L_PTE_USER)) | ||
228 | 230 | ||
229 | #define PTE_BIT_FUNC(fn,op) \ | 231 | #define PTE_BIT_FUNC(fn,op) \ |
230 | static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; } | 232 | static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; } |
@@ -251,13 +253,13 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
251 | * | 253 | * |
252 | * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 | 254 | * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 |
253 | * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 | 255 | * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 |
254 | * <--------------- offset --------------------> <- type --> 0 0 0 | 256 | * <--------------- offset ----------------------> < type -> 0 0 0 |
255 | * | 257 | * |
256 | * This gives us up to 63 swap files and 32GB per swap file. Note that | 258 | * This gives us up to 31 swap files and 64GB per swap file. Note that |
257 | * the offset field is always non-zero. | 259 | * the offset field is always non-zero. |
258 | */ | 260 | */ |
259 | #define __SWP_TYPE_SHIFT 3 | 261 | #define __SWP_TYPE_SHIFT 3 |
260 | #define __SWP_TYPE_BITS 6 | 262 | #define __SWP_TYPE_BITS 5 |
261 | #define __SWP_TYPE_MASK ((1 << __SWP_TYPE_BITS) - 1) | 263 | #define __SWP_TYPE_MASK ((1 << __SWP_TYPE_BITS) - 1) |
262 | #define __SWP_OFFSET_SHIFT (__SWP_TYPE_BITS + __SWP_TYPE_SHIFT) | 264 | #define __SWP_OFFSET_SHIFT (__SWP_TYPE_BITS + __SWP_TYPE_SHIFT) |
263 | 265 | ||