diff options
Diffstat (limited to 'include')
26 files changed, 1 insertions, 301 deletions
diff --git a/include/asm-alpha/pgtable.h b/include/asm-alpha/pgtable.h index 616d20662ff3..99037b032357 100644 --- a/include/asm-alpha/pgtable.h +++ b/include/asm-alpha/pgtable.h | |||
@@ -264,21 +264,15 @@ extern inline void pgd_clear(pgd_t * pgdp) { pgd_val(*pgdp) = 0; } | |||
264 | * The following only work if pte_present() is true. | 264 | * The following only work if pte_present() is true. |
265 | * Undefined behaviour if not.. | 265 | * Undefined behaviour if not.. |
266 | */ | 266 | */ |
267 | extern inline int pte_read(pte_t pte) { return !(pte_val(pte) & _PAGE_FOR); } | ||
268 | extern inline int pte_write(pte_t pte) { return !(pte_val(pte) & _PAGE_FOW); } | 267 | extern inline int pte_write(pte_t pte) { return !(pte_val(pte) & _PAGE_FOW); } |
269 | extern inline int pte_exec(pte_t pte) { return !(pte_val(pte) & _PAGE_FOE); } | ||
270 | extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } | 268 | extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } |
271 | extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } | 269 | extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } |
272 | extern inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } | 270 | extern inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } |
273 | 271 | ||
274 | extern inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_FOW; return pte; } | 272 | extern inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_FOW; return pte; } |
275 | extern inline pte_t pte_rdprotect(pte_t pte) { pte_val(pte) |= _PAGE_FOR; return pte; } | ||
276 | extern inline pte_t pte_exprotect(pte_t pte) { pte_val(pte) |= _PAGE_FOE; return pte; } | ||
277 | extern inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~(__DIRTY_BITS); return pte; } | 273 | extern inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~(__DIRTY_BITS); return pte; } |
278 | extern inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~(__ACCESS_BITS); return pte; } | 274 | extern inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~(__ACCESS_BITS); return pte; } |
279 | extern inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) &= ~_PAGE_FOW; return pte; } | 275 | extern inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) &= ~_PAGE_FOW; return pte; } |
280 | extern inline pte_t pte_mkread(pte_t pte) { pte_val(pte) &= ~_PAGE_FOR; return pte; } | ||
281 | extern inline pte_t pte_mkexec(pte_t pte) { pte_val(pte) &= ~_PAGE_FOE; return pte; } | ||
282 | extern inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= __DIRTY_BITS; return pte; } | 276 | extern inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= __DIRTY_BITS; return pte; } |
283 | extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= __ACCESS_BITS; return pte; } | 277 | extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= __ACCESS_BITS; return pte; } |
284 | 278 | ||
diff --git a/include/asm-arm/pgtable.h b/include/asm-arm/pgtable.h index 21dec9f258d8..cb4c2c9d000a 100644 --- a/include/asm-arm/pgtable.h +++ b/include/asm-arm/pgtable.h | |||
@@ -257,9 +257,7 @@ extern struct page *empty_zero_page; | |||
257 | * Undefined behaviour if not.. | 257 | * Undefined behaviour if not.. |
258 | */ | 258 | */ |
259 | #define pte_present(pte) (pte_val(pte) & L_PTE_PRESENT) | 259 | #define pte_present(pte) (pte_val(pte) & L_PTE_PRESENT) |
260 | #define pte_read(pte) (pte_val(pte) & L_PTE_USER) | ||
261 | #define pte_write(pte) (pte_val(pte) & L_PTE_WRITE) | 260 | #define pte_write(pte) (pte_val(pte) & L_PTE_WRITE) |
262 | #define pte_exec(pte) (pte_val(pte) & L_PTE_EXEC) | ||
263 | #define pte_dirty(pte) (pte_val(pte) & L_PTE_DIRTY) | 261 | #define pte_dirty(pte) (pte_val(pte) & L_PTE_DIRTY) |
264 | #define pte_young(pte) (pte_val(pte) & L_PTE_YOUNG) | 262 | #define pte_young(pte) (pte_val(pte) & L_PTE_YOUNG) |
265 | 263 | ||
@@ -275,12 +273,8 @@ extern struct page *empty_zero_page; | |||
275 | #define PTE_BIT_FUNC(fn,op) \ | 273 | #define PTE_BIT_FUNC(fn,op) \ |
276 | static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; } | 274 | static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; } |
277 | 275 | ||
278 | /*PTE_BIT_FUNC(rdprotect, &= ~L_PTE_USER);*/ | ||
279 | /*PTE_BIT_FUNC(mkread, |= L_PTE_USER);*/ | ||
280 | PTE_BIT_FUNC(wrprotect, &= ~L_PTE_WRITE); | 276 | PTE_BIT_FUNC(wrprotect, &= ~L_PTE_WRITE); |
281 | PTE_BIT_FUNC(mkwrite, |= L_PTE_WRITE); | 277 | PTE_BIT_FUNC(mkwrite, |= L_PTE_WRITE); |
282 | PTE_BIT_FUNC(exprotect, &= ~L_PTE_EXEC); | ||
283 | PTE_BIT_FUNC(mkexec, |= L_PTE_EXEC); | ||
284 | PTE_BIT_FUNC(mkclean, &= ~L_PTE_DIRTY); | 278 | PTE_BIT_FUNC(mkclean, &= ~L_PTE_DIRTY); |
285 | PTE_BIT_FUNC(mkdirty, |= L_PTE_DIRTY); | 279 | PTE_BIT_FUNC(mkdirty, |= L_PTE_DIRTY); |
286 | PTE_BIT_FUNC(mkold, &= ~L_PTE_YOUNG); | 280 | PTE_BIT_FUNC(mkold, &= ~L_PTE_YOUNG); |
diff --git a/include/asm-arm26/pgtable.h b/include/asm-arm26/pgtable.h index 2b20e9f08857..55a1a697d12b 100644 --- a/include/asm-arm26/pgtable.h +++ b/include/asm-arm26/pgtable.h | |||
@@ -218,9 +218,7 @@ extern struct page *empty_zero_page; | |||
218 | * The following only work if pte_present() is true. | 218 | * The following only work if pte_present() is true. |
219 | * Undefined behaviour if not.. | 219 | * Undefined behaviour if not.. |
220 | */ | 220 | */ |
221 | #define pte_read(pte) (!(pte_val(pte) & _PAGE_NOT_USER)) | ||
222 | #define pte_write(pte) (!(pte_val(pte) & _PAGE_READONLY)) | 221 | #define pte_write(pte) (!(pte_val(pte) & _PAGE_READONLY)) |
223 | #define pte_exec(pte) (!(pte_val(pte) & _PAGE_NOT_USER)) | ||
224 | #define pte_dirty(pte) (!(pte_val(pte) & _PAGE_CLEAN)) | 222 | #define pte_dirty(pte) (!(pte_val(pte) & _PAGE_CLEAN)) |
225 | #define pte_young(pte) (!(pte_val(pte) & _PAGE_OLD)) | 223 | #define pte_young(pte) (!(pte_val(pte) & _PAGE_OLD)) |
226 | //ONLY when !pte_present() I think. nicked from arm32 (FIXME!) | 224 | //ONLY when !pte_present() I think. nicked from arm32 (FIXME!) |
@@ -231,8 +229,6 @@ static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; } | |||
231 | 229 | ||
232 | PTE_BIT_FUNC(wrprotect, |= _PAGE_READONLY); | 230 | PTE_BIT_FUNC(wrprotect, |= _PAGE_READONLY); |
233 | PTE_BIT_FUNC(mkwrite, &= ~_PAGE_READONLY); | 231 | PTE_BIT_FUNC(mkwrite, &= ~_PAGE_READONLY); |
234 | PTE_BIT_FUNC(exprotect, |= _PAGE_NOT_USER); | ||
235 | PTE_BIT_FUNC(mkexec, &= ~_PAGE_NOT_USER); | ||
236 | PTE_BIT_FUNC(mkclean, |= _PAGE_CLEAN); | 232 | PTE_BIT_FUNC(mkclean, |= _PAGE_CLEAN); |
237 | PTE_BIT_FUNC(mkdirty, &= ~_PAGE_CLEAN); | 233 | PTE_BIT_FUNC(mkdirty, &= ~_PAGE_CLEAN); |
238 | PTE_BIT_FUNC(mkold, |= _PAGE_OLD); | 234 | PTE_BIT_FUNC(mkold, |= _PAGE_OLD); |
diff --git a/include/asm-avr32/pgtable.h b/include/asm-avr32/pgtable.h index f6cc2b0f75c3..c07bdd10b891 100644 --- a/include/asm-avr32/pgtable.h +++ b/include/asm-avr32/pgtable.h | |||
@@ -201,18 +201,10 @@ extern struct page *empty_zero_page; | |||
201 | * The following only work if pte_present() is true. | 201 | * The following only work if pte_present() is true. |
202 | * Undefined behaviour if not.. | 202 | * Undefined behaviour if not.. |
203 | */ | 203 | */ |
204 | static inline int pte_read(pte_t pte) | ||
205 | { | ||
206 | return pte_val(pte) & _PAGE_USER; | ||
207 | } | ||
208 | static inline int pte_write(pte_t pte) | 204 | static inline int pte_write(pte_t pte) |
209 | { | 205 | { |
210 | return pte_val(pte) & _PAGE_RW; | 206 | return pte_val(pte) & _PAGE_RW; |
211 | } | 207 | } |
212 | static inline int pte_exec(pte_t pte) | ||
213 | { | ||
214 | return pte_val(pte) & _PAGE_EXECUTE; | ||
215 | } | ||
216 | static inline int pte_dirty(pte_t pte) | 208 | static inline int pte_dirty(pte_t pte) |
217 | { | 209 | { |
218 | return pte_val(pte) & _PAGE_DIRTY; | 210 | return pte_val(pte) & _PAGE_DIRTY; |
@@ -231,21 +223,11 @@ static inline int pte_file(pte_t pte) | |||
231 | } | 223 | } |
232 | 224 | ||
233 | /* Mutator functions for PTE bits */ | 225 | /* Mutator functions for PTE bits */ |
234 | static inline pte_t pte_rdprotect(pte_t pte) | ||
235 | { | ||
236 | set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); | ||
237 | return pte; | ||
238 | } | ||
239 | static inline pte_t pte_wrprotect(pte_t pte) | 226 | static inline pte_t pte_wrprotect(pte_t pte) |
240 | { | 227 | { |
241 | set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); | 228 | set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); |
242 | return pte; | 229 | return pte; |
243 | } | 230 | } |
244 | static inline pte_t pte_exprotect(pte_t pte) | ||
245 | { | ||
246 | set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_EXECUTE)); | ||
247 | return pte; | ||
248 | } | ||
249 | static inline pte_t pte_mkclean(pte_t pte) | 231 | static inline pte_t pte_mkclean(pte_t pte) |
250 | { | 232 | { |
251 | set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); | 233 | set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); |
@@ -256,21 +238,11 @@ static inline pte_t pte_mkold(pte_t pte) | |||
256 | set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); | 238 | set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); |
257 | return pte; | 239 | return pte; |
258 | } | 240 | } |
259 | static inline pte_t pte_mkread(pte_t pte) | ||
260 | { | ||
261 | set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); | ||
262 | return pte; | ||
263 | } | ||
264 | static inline pte_t pte_mkwrite(pte_t pte) | 241 | static inline pte_t pte_mkwrite(pte_t pte) |
265 | { | 242 | { |
266 | set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); | 243 | set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); |
267 | return pte; | 244 | return pte; |
268 | } | 245 | } |
269 | static inline pte_t pte_mkexec(pte_t pte) | ||
270 | { | ||
271 | set_pte(&pte, __pte(pte_val(pte) | _PAGE_EXECUTE)); | ||
272 | return pte; | ||
273 | } | ||
274 | static inline pte_t pte_mkdirty(pte_t pte) | 246 | static inline pte_t pte_mkdirty(pte_t pte) |
275 | { | 247 | { |
276 | set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); | 248 | set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); |
diff --git a/include/asm-cris/pgtable.h b/include/asm-cris/pgtable.h index c94a7107019c..417f71116215 100644 --- a/include/asm-cris/pgtable.h +++ b/include/asm-cris/pgtable.h | |||
@@ -111,9 +111,7 @@ extern unsigned long empty_zero_page; | |||
111 | * Undefined behaviour if not.. | 111 | * Undefined behaviour if not.. |
112 | */ | 112 | */ |
113 | 113 | ||
114 | static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_READ; } | ||
115 | static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } | 114 | static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } |
116 | static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_READ; } | ||
117 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; } | 115 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; } |
118 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } | 116 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } |
119 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } | 117 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } |
@@ -124,18 +122,6 @@ static inline pte_t pte_wrprotect(pte_t pte) | |||
124 | return pte; | 122 | return pte; |
125 | } | 123 | } |
126 | 124 | ||
127 | static inline pte_t pte_rdprotect(pte_t pte) | ||
128 | { | ||
129 | pte_val(pte) &= ~(_PAGE_READ | _PAGE_SILENT_READ); | ||
130 | return pte; | ||
131 | } | ||
132 | |||
133 | static inline pte_t pte_exprotect(pte_t pte) | ||
134 | { | ||
135 | pte_val(pte) &= ~(_PAGE_READ | _PAGE_SILENT_READ); | ||
136 | return pte; | ||
137 | } | ||
138 | |||
139 | static inline pte_t pte_mkclean(pte_t pte) | 125 | static inline pte_t pte_mkclean(pte_t pte) |
140 | { | 126 | { |
141 | pte_val(pte) &= ~(_PAGE_MODIFIED | _PAGE_SILENT_WRITE); | 127 | pte_val(pte) &= ~(_PAGE_MODIFIED | _PAGE_SILENT_WRITE); |
@@ -156,22 +142,6 @@ static inline pte_t pte_mkwrite(pte_t pte) | |||
156 | return pte; | 142 | return pte; |
157 | } | 143 | } |
158 | 144 | ||
159 | static inline pte_t pte_mkread(pte_t pte) | ||
160 | { | ||
161 | pte_val(pte) |= _PAGE_READ; | ||
162 | if (pte_val(pte) & _PAGE_ACCESSED) | ||
163 | pte_val(pte) |= _PAGE_SILENT_READ; | ||
164 | return pte; | ||
165 | } | ||
166 | |||
167 | static inline pte_t pte_mkexec(pte_t pte) | ||
168 | { | ||
169 | pte_val(pte) |= _PAGE_READ; | ||
170 | if (pte_val(pte) & _PAGE_ACCESSED) | ||
171 | pte_val(pte) |= _PAGE_SILENT_READ; | ||
172 | return pte; | ||
173 | } | ||
174 | |||
175 | static inline pte_t pte_mkdirty(pte_t pte) | 145 | static inline pte_t pte_mkdirty(pte_t pte) |
176 | { | 146 | { |
177 | pte_val(pte) |= _PAGE_MODIFIED; | 147 | pte_val(pte) |= _PAGE_MODIFIED; |
diff --git a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h index 114aefae2701..adde69985255 100644 --- a/include/asm-frv/pgtable.h +++ b/include/asm-frv/pgtable.h | |||
@@ -377,19 +377,13 @@ static inline pmd_t *pmd_offset(pud_t *dir, unsigned long address) | |||
377 | * The following only work if pte_present() is true. | 377 | * The following only work if pte_present() is true. |
378 | * Undefined behaviour if not.. | 378 | * Undefined behaviour if not.. |
379 | */ | 379 | */ |
380 | static inline int pte_read(pte_t pte) { return !((pte).pte & _PAGE_SUPER); } | ||
381 | static inline int pte_exec(pte_t pte) { return !((pte).pte & _PAGE_SUPER); } | ||
382 | static inline int pte_dirty(pte_t pte) { return (pte).pte & _PAGE_DIRTY; } | 380 | static inline int pte_dirty(pte_t pte) { return (pte).pte & _PAGE_DIRTY; } |
383 | static inline int pte_young(pte_t pte) { return (pte).pte & _PAGE_ACCESSED; } | 381 | static inline int pte_young(pte_t pte) { return (pte).pte & _PAGE_ACCESSED; } |
384 | static inline int pte_write(pte_t pte) { return !((pte).pte & _PAGE_WP); } | 382 | static inline int pte_write(pte_t pte) { return !((pte).pte & _PAGE_WP); } |
385 | 383 | ||
386 | static inline pte_t pte_rdprotect(pte_t pte) { (pte).pte |= _PAGE_SUPER; return pte; } | ||
387 | static inline pte_t pte_exprotect(pte_t pte) { (pte).pte |= _PAGE_SUPER; return pte; } | ||
388 | static inline pte_t pte_mkclean(pte_t pte) { (pte).pte &= ~_PAGE_DIRTY; return pte; } | 384 | static inline pte_t pte_mkclean(pte_t pte) { (pte).pte &= ~_PAGE_DIRTY; return pte; } |
389 | static inline pte_t pte_mkold(pte_t pte) { (pte).pte &= ~_PAGE_ACCESSED; return pte; } | 385 | static inline pte_t pte_mkold(pte_t pte) { (pte).pte &= ~_PAGE_ACCESSED; return pte; } |
390 | static inline pte_t pte_wrprotect(pte_t pte) { (pte).pte |= _PAGE_WP; return pte; } | 386 | static inline pte_t pte_wrprotect(pte_t pte) { (pte).pte |= _PAGE_WP; return pte; } |
391 | static inline pte_t pte_mkread(pte_t pte) { (pte).pte &= ~_PAGE_SUPER; return pte; } | ||
392 | static inline pte_t pte_mkexec(pte_t pte) { (pte).pte &= ~_PAGE_SUPER; return pte; } | ||
393 | static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte |= _PAGE_DIRTY; return pte; } | 387 | static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte |= _PAGE_DIRTY; return pte; } |
394 | static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte |= _PAGE_ACCESSED; return pte; } | 388 | static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte |= _PAGE_ACCESSED; return pte; } |
395 | static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte &= ~_PAGE_WP; return pte; } | 389 | static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte &= ~_PAGE_WP; return pte; } |
diff --git a/include/asm-i386/pgtable-2level.h b/include/asm-i386/pgtable-2level.h index a50fd1773de8..84b03cf56a79 100644 --- a/include/asm-i386/pgtable-2level.h +++ b/include/asm-i386/pgtable-2level.h | |||
@@ -57,14 +57,6 @@ static inline pte_t native_ptep_get_and_clear(pte_t *xp) | |||
57 | #define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) | 57 | #define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) |
58 | 58 | ||
59 | /* | 59 | /* |
60 | * All present user pages are user-executable: | ||
61 | */ | ||
62 | static inline int pte_exec(pte_t pte) | ||
63 | { | ||
64 | return pte_user(pte); | ||
65 | } | ||
66 | |||
67 | /* | ||
68 | * All present pages are kernel-executable: | 60 | * All present pages are kernel-executable: |
69 | */ | 61 | */ |
70 | static inline int pte_exec_kernel(pte_t pte) | 62 | static inline int pte_exec_kernel(pte_t pte) |
diff --git a/include/asm-i386/pgtable-3level.h b/include/asm-i386/pgtable-3level.h index eb0f1d7e96a1..948a33414118 100644 --- a/include/asm-i386/pgtable-3level.h +++ b/include/asm-i386/pgtable-3level.h | |||
@@ -20,26 +20,11 @@ | |||
20 | #define pud_present(pud) 1 | 20 | #define pud_present(pud) 1 |
21 | 21 | ||
22 | /* | 22 | /* |
23 | * Is the pte executable? | ||
24 | */ | ||
25 | static inline int pte_x(pte_t pte) | ||
26 | { | ||
27 | return !(pte_val(pte) & _PAGE_NX); | ||
28 | } | ||
29 | |||
30 | /* | ||
31 | * All present user-pages with !NX bit are user-executable: | ||
32 | */ | ||
33 | static inline int pte_exec(pte_t pte) | ||
34 | { | ||
35 | return pte_user(pte) && pte_x(pte); | ||
36 | } | ||
37 | /* | ||
38 | * All present pages with !NX bit are kernel-executable: | 23 | * All present pages with !NX bit are kernel-executable: |
39 | */ | 24 | */ |
40 | static inline int pte_exec_kernel(pte_t pte) | 25 | static inline int pte_exec_kernel(pte_t pte) |
41 | { | 26 | { |
42 | return pte_x(pte); | 27 | return !(pte_val(pte) & _PAGE_NX); |
43 | } | 28 | } |
44 | 29 | ||
45 | /* Rules for using set_pte: the pte being assigned *must* be | 30 | /* Rules for using set_pte: the pte being assigned *must* be |
diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h index 628fa7747d0c..0efa8063a3e9 100644 --- a/include/asm-i386/pgtable.h +++ b/include/asm-i386/pgtable.h | |||
@@ -218,8 +218,6 @@ extern unsigned long pg0[]; | |||
218 | * The following only work if pte_present() is true. | 218 | * The following only work if pte_present() is true. |
219 | * Undefined behaviour if not.. | 219 | * Undefined behaviour if not.. |
220 | */ | 220 | */ |
221 | static inline int pte_user(pte_t pte) { return (pte).pte_low & _PAGE_USER; } | ||
222 | static inline int pte_read(pte_t pte) { return (pte).pte_low & _PAGE_USER; } | ||
223 | static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_DIRTY; } | 221 | static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_DIRTY; } |
224 | static inline int pte_young(pte_t pte) { return (pte).pte_low & _PAGE_ACCESSED; } | 222 | static inline int pte_young(pte_t pte) { return (pte).pte_low & _PAGE_ACCESSED; } |
225 | static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_RW; } | 223 | static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_RW; } |
@@ -230,13 +228,9 @@ static inline int pte_huge(pte_t pte) { return (pte).pte_low & _PAGE_PSE; } | |||
230 | */ | 228 | */ |
231 | static inline int pte_file(pte_t pte) { return (pte).pte_low & _PAGE_FILE; } | 229 | static inline int pte_file(pte_t pte) { return (pte).pte_low & _PAGE_FILE; } |
232 | 230 | ||
233 | static inline pte_t pte_rdprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_USER; return pte; } | ||
234 | static inline pte_t pte_exprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_USER; return pte; } | ||
235 | static inline pte_t pte_mkclean(pte_t pte) { (pte).pte_low &= ~_PAGE_DIRTY; return pte; } | 231 | static inline pte_t pte_mkclean(pte_t pte) { (pte).pte_low &= ~_PAGE_DIRTY; return pte; } |
236 | static inline pte_t pte_mkold(pte_t pte) { (pte).pte_low &= ~_PAGE_ACCESSED; return pte; } | 232 | static inline pte_t pte_mkold(pte_t pte) { (pte).pte_low &= ~_PAGE_ACCESSED; return pte; } |
237 | static inline pte_t pte_wrprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_RW; return pte; } | 233 | static inline pte_t pte_wrprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_RW; return pte; } |
238 | static inline pte_t pte_mkread(pte_t pte) { (pte).pte_low |= _PAGE_USER; return pte; } | ||
239 | static inline pte_t pte_mkexec(pte_t pte) { (pte).pte_low |= _PAGE_USER; return pte; } | ||
240 | static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte_low |= _PAGE_DIRTY; return pte; } | 234 | static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte_low |= _PAGE_DIRTY; return pte; } |
241 | static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; return pte; } | 235 | static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; return pte; } |
242 | static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; } | 236 | static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; } |
diff --git a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h index 6580f31b3135..f923d811c421 100644 --- a/include/asm-ia64/pgtable.h +++ b/include/asm-ia64/pgtable.h | |||
@@ -297,8 +297,6 @@ ia64_phys_addr_valid (unsigned long addr) | |||
297 | /* | 297 | /* |
298 | * The following have defined behavior only work if pte_present() is true. | 298 | * The following have defined behavior only work if pte_present() is true. |
299 | */ | 299 | */ |
300 | #define pte_user(pte) ((pte_val(pte) & _PAGE_PL_MASK) == _PAGE_PL_3) | ||
301 | #define pte_read(pte) (((pte_val(pte) & _PAGE_AR_MASK) >> _PAGE_AR_SHIFT) < 6) | ||
302 | #define pte_write(pte) ((unsigned) (((pte_val(pte) & _PAGE_AR_MASK) >> _PAGE_AR_SHIFT) - 2) <= 4) | 300 | #define pte_write(pte) ((unsigned) (((pte_val(pte) & _PAGE_AR_MASK) >> _PAGE_AR_SHIFT) - 2) <= 4) |
303 | #define pte_exec(pte) ((pte_val(pte) & _PAGE_AR_RX) != 0) | 301 | #define pte_exec(pte) ((pte_val(pte) & _PAGE_AR_RX) != 0) |
304 | #define pte_dirty(pte) ((pte_val(pte) & _PAGE_D) != 0) | 302 | #define pte_dirty(pte) ((pte_val(pte) & _PAGE_D) != 0) |
@@ -310,7 +308,6 @@ ia64_phys_addr_valid (unsigned long addr) | |||
310 | */ | 308 | */ |
311 | #define pte_wrprotect(pte) (__pte(pte_val(pte) & ~_PAGE_AR_RW)) | 309 | #define pte_wrprotect(pte) (__pte(pte_val(pte) & ~_PAGE_AR_RW)) |
312 | #define pte_mkwrite(pte) (__pte(pte_val(pte) | _PAGE_AR_RW)) | 310 | #define pte_mkwrite(pte) (__pte(pte_val(pte) | _PAGE_AR_RW)) |
313 | #define pte_mkexec(pte) (__pte(pte_val(pte) | _PAGE_AR_RX)) | ||
314 | #define pte_mkold(pte) (__pte(pte_val(pte) & ~_PAGE_A)) | 311 | #define pte_mkold(pte) (__pte(pte_val(pte) & ~_PAGE_A)) |
315 | #define pte_mkyoung(pte) (__pte(pte_val(pte) | _PAGE_A)) | 312 | #define pte_mkyoung(pte) (__pte(pte_val(pte) | _PAGE_A)) |
316 | #define pte_mkclean(pte) (__pte(pte_val(pte) & ~_PAGE_D)) | 313 | #define pte_mkclean(pte) (__pte(pte_val(pte) & ~_PAGE_D)) |
diff --git a/include/asm-m32r/pgtable.h b/include/asm-m32r/pgtable.h index 6604303fc47c..35af58c6b812 100644 --- a/include/asm-m32r/pgtable.h +++ b/include/asm-m32r/pgtable.h | |||
@@ -191,16 +191,6 @@ extern unsigned long empty_zero_page[1024]; | |||
191 | * The following only work if pte_present() is true. | 191 | * The following only work if pte_present() is true. |
192 | * Undefined behaviour if not.. | 192 | * Undefined behaviour if not.. |
193 | */ | 193 | */ |
194 | static inline int pte_read(pte_t pte) | ||
195 | { | ||
196 | return pte_val(pte) & _PAGE_READ; | ||
197 | } | ||
198 | |||
199 | static inline int pte_exec(pte_t pte) | ||
200 | { | ||
201 | return pte_val(pte) & _PAGE_EXEC; | ||
202 | } | ||
203 | |||
204 | static inline int pte_dirty(pte_t pte) | 194 | static inline int pte_dirty(pte_t pte) |
205 | { | 195 | { |
206 | return pte_val(pte) & _PAGE_DIRTY; | 196 | return pte_val(pte) & _PAGE_DIRTY; |
@@ -224,18 +214,6 @@ static inline int pte_file(pte_t pte) | |||
224 | return pte_val(pte) & _PAGE_FILE; | 214 | return pte_val(pte) & _PAGE_FILE; |
225 | } | 215 | } |
226 | 216 | ||
227 | static inline pte_t pte_rdprotect(pte_t pte) | ||
228 | { | ||
229 | pte_val(pte) &= ~_PAGE_READ; | ||
230 | return pte; | ||
231 | } | ||
232 | |||
233 | static inline pte_t pte_exprotect(pte_t pte) | ||
234 | { | ||
235 | pte_val(pte) &= ~_PAGE_EXEC; | ||
236 | return pte; | ||
237 | } | ||
238 | |||
239 | static inline pte_t pte_mkclean(pte_t pte) | 217 | static inline pte_t pte_mkclean(pte_t pte) |
240 | { | 218 | { |
241 | pte_val(pte) &= ~_PAGE_DIRTY; | 219 | pte_val(pte) &= ~_PAGE_DIRTY; |
@@ -254,18 +232,6 @@ static inline pte_t pte_wrprotect(pte_t pte) | |||
254 | return pte; | 232 | return pte; |
255 | } | 233 | } |
256 | 234 | ||
257 | static inline pte_t pte_mkread(pte_t pte) | ||
258 | { | ||
259 | pte_val(pte) |= _PAGE_READ; | ||
260 | return pte; | ||
261 | } | ||
262 | |||
263 | static inline pte_t pte_mkexec(pte_t pte) | ||
264 | { | ||
265 | pte_val(pte) |= _PAGE_EXEC; | ||
266 | return pte; | ||
267 | } | ||
268 | |||
269 | static inline pte_t pte_mkdirty(pte_t pte) | 235 | static inline pte_t pte_mkdirty(pte_t pte) |
270 | { | 236 | { |
271 | pte_val(pte) |= _PAGE_DIRTY; | 237 | pte_val(pte) |= _PAGE_DIRTY; |
diff --git a/include/asm-m68k/motorola_pgtable.h b/include/asm-m68k/motorola_pgtable.h index b5b78c01eb6c..d029b75bcf04 100644 --- a/include/asm-m68k/motorola_pgtable.h +++ b/include/asm-m68k/motorola_pgtable.h | |||
@@ -164,21 +164,15 @@ static inline void pgd_set(pgd_t *pgdp, pmd_t *pmdp) | |||
164 | * The following only work if pte_present() is true. | 164 | * The following only work if pte_present() is true. |
165 | * Undefined behaviour if not.. | 165 | * Undefined behaviour if not.. |
166 | */ | 166 | */ |
167 | static inline int pte_read(pte_t pte) { return 1; } | ||
168 | static inline int pte_write(pte_t pte) { return !(pte_val(pte) & _PAGE_RONLY); } | 167 | static inline int pte_write(pte_t pte) { return !(pte_val(pte) & _PAGE_RONLY); } |
169 | static inline int pte_exec(pte_t pte) { return 1; } | ||
170 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } | 168 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } |
171 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } | 169 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } |
172 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } | 170 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } |
173 | 171 | ||
174 | static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_RONLY; return pte; } | 172 | static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_RONLY; return pte; } |
175 | static inline pte_t pte_rdprotect(pte_t pte) { return pte; } | ||
176 | static inline pte_t pte_exprotect(pte_t pte) { return pte; } | ||
177 | static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } | 173 | static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } |
178 | static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } | 174 | static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } |
179 | static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) &= ~_PAGE_RONLY; return pte; } | 175 | static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) &= ~_PAGE_RONLY; return pte; } |
180 | static inline pte_t pte_mkread(pte_t pte) { return pte; } | ||
181 | static inline pte_t pte_mkexec(pte_t pte) { return pte; } | ||
182 | static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } | 176 | static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } |
183 | static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } | 177 | static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } |
184 | static inline pte_t pte_mknocache(pte_t pte) | 178 | static inline pte_t pte_mknocache(pte_t pte) |
diff --git a/include/asm-m68k/sun3_pgtable.h b/include/asm-m68k/sun3_pgtable.h index b9e62c1e7ae3..b766fc261bde 100644 --- a/include/asm-m68k/sun3_pgtable.h +++ b/include/asm-m68k/sun3_pgtable.h | |||
@@ -165,21 +165,15 @@ static inline void pgd_clear (pgd_t *pgdp) {} | |||
165 | * Undefined behaviour if not... | 165 | * Undefined behaviour if not... |
166 | * [we have the full set here even if they don't change from m68k] | 166 | * [we have the full set here even if they don't change from m68k] |
167 | */ | 167 | */ |
168 | static inline int pte_read(pte_t pte) { return 1; } | ||
169 | static inline int pte_write(pte_t pte) { return pte_val(pte) & SUN3_PAGE_WRITEABLE; } | 168 | static inline int pte_write(pte_t pte) { return pte_val(pte) & SUN3_PAGE_WRITEABLE; } |
170 | static inline int pte_exec(pte_t pte) { return 1; } | ||
171 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & SUN3_PAGE_MODIFIED; } | 169 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & SUN3_PAGE_MODIFIED; } |
172 | static inline int pte_young(pte_t pte) { return pte_val(pte) & SUN3_PAGE_ACCESSED; } | 170 | static inline int pte_young(pte_t pte) { return pte_val(pte) & SUN3_PAGE_ACCESSED; } |
173 | static inline int pte_file(pte_t pte) { return pte_val(pte) & SUN3_PAGE_ACCESSED; } | 171 | static inline int pte_file(pte_t pte) { return pte_val(pte) & SUN3_PAGE_ACCESSED; } |
174 | 172 | ||
175 | static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_WRITEABLE; return pte; } | 173 | static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_WRITEABLE; return pte; } |
176 | static inline pte_t pte_rdprotect(pte_t pte) { return pte; } | ||
177 | static inline pte_t pte_exprotect(pte_t pte) { return pte; } | ||
178 | static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_MODIFIED; return pte; } | 174 | static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_MODIFIED; return pte; } |
179 | static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_ACCESSED; return pte; } | 175 | static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_ACCESSED; return pte; } |
180 | static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= SUN3_PAGE_WRITEABLE; return pte; } | 176 | static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= SUN3_PAGE_WRITEABLE; return pte; } |
181 | static inline pte_t pte_mkread(pte_t pte) { return pte; } | ||
182 | static inline pte_t pte_mkexec(pte_t pte) { return pte; } | ||
183 | static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= SUN3_PAGE_MODIFIED; return pte; } | 177 | static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= SUN3_PAGE_MODIFIED; return pte; } |
184 | static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= SUN3_PAGE_ACCESSED; return pte; } | 178 | static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= SUN3_PAGE_ACCESSED; return pte; } |
185 | static inline pte_t pte_mknocache(pte_t pte) { pte_val(pte) |= SUN3_PAGE_NOCACHE; return pte; } | 179 | static inline pte_t pte_mknocache(pte_t pte) { pte_val(pte) |= SUN3_PAGE_NOCACHE; return pte; } |
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h index 27d77d981937..2e2d70d13ff6 100644 --- a/include/asm-mips/pgtable.h +++ b/include/asm-mips/pgtable.h | |||
@@ -178,9 +178,7 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; | |||
178 | * The following only work if pte_present() is true. | 178 | * The following only work if pte_present() is true. |
179 | * Undefined behaviour if not.. | 179 | * Undefined behaviour if not.. |
180 | */ | 180 | */ |
181 | static inline int pte_user(pte_t pte) { BUG(); return 0; } | ||
182 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) | 181 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) |
183 | static inline int pte_read(pte_t pte) { return pte.pte_low & _PAGE_READ; } | ||
184 | static inline int pte_write(pte_t pte) { return pte.pte_low & _PAGE_WRITE; } | 182 | static inline int pte_write(pte_t pte) { return pte.pte_low & _PAGE_WRITE; } |
185 | static inline int pte_dirty(pte_t pte) { return pte.pte_low & _PAGE_MODIFIED; } | 183 | static inline int pte_dirty(pte_t pte) { return pte.pte_low & _PAGE_MODIFIED; } |
186 | static inline int pte_young(pte_t pte) { return pte.pte_low & _PAGE_ACCESSED; } | 184 | static inline int pte_young(pte_t pte) { return pte.pte_low & _PAGE_ACCESSED; } |
@@ -193,13 +191,6 @@ static inline pte_t pte_wrprotect(pte_t pte) | |||
193 | return pte; | 191 | return pte; |
194 | } | 192 | } |
195 | 193 | ||
196 | static inline pte_t pte_rdprotect(pte_t pte) | ||
197 | { | ||
198 | pte.pte_low &= ~(_PAGE_READ | _PAGE_SILENT_READ); | ||
199 | pte.pte_high &= ~_PAGE_SILENT_READ; | ||
200 | return pte; | ||
201 | } | ||
202 | |||
203 | static inline pte_t pte_mkclean(pte_t pte) | 194 | static inline pte_t pte_mkclean(pte_t pte) |
204 | { | 195 | { |
205 | pte.pte_low &= ~(_PAGE_MODIFIED | _PAGE_SILENT_WRITE); | 196 | pte.pte_low &= ~(_PAGE_MODIFIED | _PAGE_SILENT_WRITE); |
@@ -224,16 +215,6 @@ static inline pte_t pte_mkwrite(pte_t pte) | |||
224 | return pte; | 215 | return pte; |
225 | } | 216 | } |
226 | 217 | ||
227 | static inline pte_t pte_mkread(pte_t pte) | ||
228 | { | ||
229 | pte.pte_low |= _PAGE_READ; | ||
230 | if (pte.pte_low & _PAGE_ACCESSED) { | ||
231 | pte.pte_low |= _PAGE_SILENT_READ; | ||
232 | pte.pte_high |= _PAGE_SILENT_READ; | ||
233 | } | ||
234 | return pte; | ||
235 | } | ||
236 | |||
237 | static inline pte_t pte_mkdirty(pte_t pte) | 218 | static inline pte_t pte_mkdirty(pte_t pte) |
238 | { | 219 | { |
239 | pte.pte_low |= _PAGE_MODIFIED; | 220 | pte.pte_low |= _PAGE_MODIFIED; |
@@ -253,7 +234,6 @@ static inline pte_t pte_mkyoung(pte_t pte) | |||
253 | return pte; | 234 | return pte; |
254 | } | 235 | } |
255 | #else | 236 | #else |
256 | static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_READ; } | ||
257 | static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } | 237 | static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } |
258 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; } | 238 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; } |
259 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } | 239 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } |
@@ -265,12 +245,6 @@ static inline pte_t pte_wrprotect(pte_t pte) | |||
265 | return pte; | 245 | return pte; |
266 | } | 246 | } |
267 | 247 | ||
268 | static inline pte_t pte_rdprotect(pte_t pte) | ||
269 | { | ||
270 | pte_val(pte) &= ~(_PAGE_READ | _PAGE_SILENT_READ); | ||
271 | return pte; | ||
272 | } | ||
273 | |||
274 | static inline pte_t pte_mkclean(pte_t pte) | 248 | static inline pte_t pte_mkclean(pte_t pte) |
275 | { | 249 | { |
276 | pte_val(pte) &= ~(_PAGE_MODIFIED|_PAGE_SILENT_WRITE); | 250 | pte_val(pte) &= ~(_PAGE_MODIFIED|_PAGE_SILENT_WRITE); |
@@ -291,14 +265,6 @@ static inline pte_t pte_mkwrite(pte_t pte) | |||
291 | return pte; | 265 | return pte; |
292 | } | 266 | } |
293 | 267 | ||
294 | static inline pte_t pte_mkread(pte_t pte) | ||
295 | { | ||
296 | pte_val(pte) |= _PAGE_READ; | ||
297 | if (pte_val(pte) & _PAGE_ACCESSED) | ||
298 | pte_val(pte) |= _PAGE_SILENT_READ; | ||
299 | return pte; | ||
300 | } | ||
301 | |||
302 | static inline pte_t pte_mkdirty(pte_t pte) | 268 | static inline pte_t pte_mkdirty(pte_t pte) |
303 | { | 269 | { |
304 | pte_val(pte) |= _PAGE_MODIFIED; | 270 | pte_val(pte) |= _PAGE_MODIFIED; |
diff --git a/include/asm-parisc/pgtable.h b/include/asm-parisc/pgtable.h index beb2adb979d9..7e222c8ba739 100644 --- a/include/asm-parisc/pgtable.h +++ b/include/asm-parisc/pgtable.h | |||
@@ -335,18 +335,14 @@ extern inline void pgd_clear(pgd_t * pgdp) { } | |||
335 | * The following only work if pte_present() is true. | 335 | * The following only work if pte_present() is true. |
336 | * Undefined behaviour if not.. | 336 | * Undefined behaviour if not.. |
337 | */ | 337 | */ |
338 | extern inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_READ; } | ||
339 | extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } | 338 | extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } |
340 | extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } | 339 | extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } |
341 | extern inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } | 340 | extern inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } |
342 | extern inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } | 341 | extern inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } |
343 | extern inline int pte_user(pte_t pte) { return pte_val(pte) & _PAGE_USER; } | ||
344 | 342 | ||
345 | extern inline pte_t pte_rdprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_READ; return pte; } | ||
346 | extern inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } | 343 | extern inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } |
347 | extern inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } | 344 | extern inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } |
348 | extern inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_WRITE; return pte; } | 345 | extern inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_WRITE; return pte; } |
349 | extern inline pte_t pte_mkread(pte_t pte) { pte_val(pte) |= _PAGE_READ; return pte; } | ||
350 | extern inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } | 346 | extern inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } |
351 | extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } | 347 | extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } |
352 | extern inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_WRITE; return pte; } | 348 | extern inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_WRITE; return pte; } |
diff --git a/include/asm-powerpc/pgtable-ppc32.h b/include/asm-powerpc/pgtable-ppc32.h index 7fb730c62f83..973c1c13bdc0 100644 --- a/include/asm-powerpc/pgtable-ppc32.h +++ b/include/asm-powerpc/pgtable-ppc32.h | |||
@@ -512,9 +512,7 @@ extern unsigned long empty_zero_page[1024]; | |||
512 | * The following only work if pte_present() is true. | 512 | * The following only work if pte_present() is true. |
513 | * Undefined behaviour if not.. | 513 | * Undefined behaviour if not.. |
514 | */ | 514 | */ |
515 | static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; } | ||
516 | static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } | 515 | static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } |
517 | static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_EXEC; } | ||
518 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } | 516 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } |
519 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } | 517 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } |
520 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } | 518 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } |
@@ -522,21 +520,13 @@ static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } | |||
522 | static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } | 520 | static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } |
523 | static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } | 521 | static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } |
524 | 522 | ||
525 | static inline pte_t pte_rdprotect(pte_t pte) { | ||
526 | pte_val(pte) &= ~_PAGE_USER; return pte; } | ||
527 | static inline pte_t pte_wrprotect(pte_t pte) { | 523 | static inline pte_t pte_wrprotect(pte_t pte) { |
528 | pte_val(pte) &= ~(_PAGE_RW | _PAGE_HWWRITE); return pte; } | 524 | pte_val(pte) &= ~(_PAGE_RW | _PAGE_HWWRITE); return pte; } |
529 | static inline pte_t pte_exprotect(pte_t pte) { | ||
530 | pte_val(pte) &= ~_PAGE_EXEC; return pte; } | ||
531 | static inline pte_t pte_mkclean(pte_t pte) { | 525 | static inline pte_t pte_mkclean(pte_t pte) { |
532 | pte_val(pte) &= ~(_PAGE_DIRTY | _PAGE_HWWRITE); return pte; } | 526 | pte_val(pte) &= ~(_PAGE_DIRTY | _PAGE_HWWRITE); return pte; } |
533 | static inline pte_t pte_mkold(pte_t pte) { | 527 | static inline pte_t pte_mkold(pte_t pte) { |
534 | pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } | 528 | pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } |
535 | 529 | ||
536 | static inline pte_t pte_mkread(pte_t pte) { | ||
537 | pte_val(pte) |= _PAGE_USER; return pte; } | ||
538 | static inline pte_t pte_mkexec(pte_t pte) { | ||
539 | pte_val(pte) |= _PAGE_USER | _PAGE_EXEC; return pte; } | ||
540 | static inline pte_t pte_mkwrite(pte_t pte) { | 530 | static inline pte_t pte_mkwrite(pte_t pte) { |
541 | pte_val(pte) |= _PAGE_RW; return pte; } | 531 | pte_val(pte) |= _PAGE_RW; return pte; } |
542 | static inline pte_t pte_mkdirty(pte_t pte) { | 532 | static inline pte_t pte_mkdirty(pte_t pte) { |
diff --git a/include/asm-powerpc/pgtable-ppc64.h b/include/asm-powerpc/pgtable-ppc64.h index 3cfd98f44bfe..0c879121c8fc 100644 --- a/include/asm-powerpc/pgtable-ppc64.h +++ b/include/asm-powerpc/pgtable-ppc64.h | |||
@@ -232,9 +232,7 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot) | |||
232 | * The following only work if pte_present() is true. | 232 | * The following only work if pte_present() is true. |
233 | * Undefined behaviour if not.. | 233 | * Undefined behaviour if not.. |
234 | */ | 234 | */ |
235 | static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER;} | ||
236 | static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW;} | 235 | static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW;} |
237 | static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_EXEC;} | ||
238 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY;} | 236 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY;} |
239 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED;} | 237 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED;} |
240 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE;} | 238 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE;} |
@@ -242,20 +240,12 @@ static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE;} | |||
242 | static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } | 240 | static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } |
243 | static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } | 241 | static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } |
244 | 242 | ||
245 | static inline pte_t pte_rdprotect(pte_t pte) { | ||
246 | pte_val(pte) &= ~_PAGE_USER; return pte; } | ||
247 | static inline pte_t pte_exprotect(pte_t pte) { | ||
248 | pte_val(pte) &= ~_PAGE_EXEC; return pte; } | ||
249 | static inline pte_t pte_wrprotect(pte_t pte) { | 243 | static inline pte_t pte_wrprotect(pte_t pte) { |
250 | pte_val(pte) &= ~(_PAGE_RW); return pte; } | 244 | pte_val(pte) &= ~(_PAGE_RW); return pte; } |
251 | static inline pte_t pte_mkclean(pte_t pte) { | 245 | static inline pte_t pte_mkclean(pte_t pte) { |
252 | pte_val(pte) &= ~(_PAGE_DIRTY); return pte; } | 246 | pte_val(pte) &= ~(_PAGE_DIRTY); return pte; } |
253 | static inline pte_t pte_mkold(pte_t pte) { | 247 | static inline pte_t pte_mkold(pte_t pte) { |
254 | pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } | 248 | pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } |
255 | static inline pte_t pte_mkread(pte_t pte) { | ||
256 | pte_val(pte) |= _PAGE_USER; return pte; } | ||
257 | static inline pte_t pte_mkexec(pte_t pte) { | ||
258 | pte_val(pte) |= _PAGE_USER | _PAGE_EXEC; return pte; } | ||
259 | static inline pte_t pte_mkwrite(pte_t pte) { | 249 | static inline pte_t pte_mkwrite(pte_t pte) { |
260 | pte_val(pte) |= _PAGE_RW; return pte; } | 250 | pte_val(pte) |= _PAGE_RW; return pte; } |
261 | static inline pte_t pte_mkdirty(pte_t pte) { | 251 | static inline pte_t pte_mkdirty(pte_t pte) { |
diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h index 9d0ce9ff5840..18aa776313b9 100644 --- a/include/asm-ppc/pgtable.h +++ b/include/asm-ppc/pgtable.h | |||
@@ -533,9 +533,7 @@ static inline int pgd_present(pgd_t pgd) { return 1; } | |||
533 | * The following only work if pte_present() is true. | 533 | * The following only work if pte_present() is true. |
534 | * Undefined behaviour if not.. | 534 | * Undefined behaviour if not.. |
535 | */ | 535 | */ |
536 | static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; } | ||
537 | static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } | 536 | static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } |
538 | static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_EXEC; } | ||
539 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } | 537 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } |
540 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } | 538 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } |
541 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } | 539 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } |
@@ -543,21 +541,13 @@ static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } | |||
543 | static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } | 541 | static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } |
544 | static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } | 542 | static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } |
545 | 543 | ||
546 | static inline pte_t pte_rdprotect(pte_t pte) { | ||
547 | pte_val(pte) &= ~_PAGE_USER; return pte; } | ||
548 | static inline pte_t pte_wrprotect(pte_t pte) { | 544 | static inline pte_t pte_wrprotect(pte_t pte) { |
549 | pte_val(pte) &= ~(_PAGE_RW | _PAGE_HWWRITE); return pte; } | 545 | pte_val(pte) &= ~(_PAGE_RW | _PAGE_HWWRITE); return pte; } |
550 | static inline pte_t pte_exprotect(pte_t pte) { | ||
551 | pte_val(pte) &= ~_PAGE_EXEC; return pte; } | ||
552 | static inline pte_t pte_mkclean(pte_t pte) { | 546 | static inline pte_t pte_mkclean(pte_t pte) { |
553 | pte_val(pte) &= ~(_PAGE_DIRTY | _PAGE_HWWRITE); return pte; } | 547 | pte_val(pte) &= ~(_PAGE_DIRTY | _PAGE_HWWRITE); return pte; } |
554 | static inline pte_t pte_mkold(pte_t pte) { | 548 | static inline pte_t pte_mkold(pte_t pte) { |
555 | pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } | 549 | pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } |
556 | 550 | ||
557 | static inline pte_t pte_mkread(pte_t pte) { | ||
558 | pte_val(pte) |= _PAGE_USER; return pte; } | ||
559 | static inline pte_t pte_mkexec(pte_t pte) { | ||
560 | pte_val(pte) |= _PAGE_USER | _PAGE_EXEC; return pte; } | ||
561 | static inline pte_t pte_mkwrite(pte_t pte) { | 551 | static inline pte_t pte_mkwrite(pte_t pte) { |
562 | pte_val(pte) |= _PAGE_RW; return pte; } | 552 | pte_val(pte) |= _PAGE_RW; return pte; } |
563 | static inline pte_t pte_mkdirty(pte_t pte) { | 553 | static inline pte_t pte_mkdirty(pte_t pte) { |
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h index 0a307bb2f353..26215a976127 100644 --- a/include/asm-s390/pgtable.h +++ b/include/asm-s390/pgtable.h | |||
@@ -530,14 +530,6 @@ static inline int pte_young(pte_t pte) | |||
530 | return 0; | 530 | return 0; |
531 | } | 531 | } |
532 | 532 | ||
533 | static inline int pte_read(pte_t pte) | ||
534 | { | ||
535 | /* All pages are readable since we don't use the fetch | ||
536 | * protection bit in the storage key. | ||
537 | */ | ||
538 | return 1; | ||
539 | } | ||
540 | |||
541 | /* | 533 | /* |
542 | * pgd/pmd/pte modification functions | 534 | * pgd/pmd/pte modification functions |
543 | */ | 535 | */ |
diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h index 5b523c7e7d99..22efffe45019 100644 --- a/include/asm-sh/pgtable.h +++ b/include/asm-sh/pgtable.h | |||
@@ -402,12 +402,8 @@ static inline void set_pte(pte_t *ptep, pte_t pte) | |||
402 | #define pte_file(pte) (pte_val(pte) & _PAGE_FILE) | 402 | #define pte_file(pte) (pte_val(pte) & _PAGE_FILE) |
403 | 403 | ||
404 | #ifdef CONFIG_X2TLB | 404 | #ifdef CONFIG_X2TLB |
405 | #define pte_read(pte) ((pte).pte_high & _PAGE_EXT_USER_READ) | ||
406 | #define pte_exec(pte) ((pte).pte_high & _PAGE_EXT_USER_EXEC) | ||
407 | #define pte_write(pte) ((pte).pte_high & _PAGE_EXT_USER_WRITE) | 405 | #define pte_write(pte) ((pte).pte_high & _PAGE_EXT_USER_WRITE) |
408 | #else | 406 | #else |
409 | #define pte_read(pte) (pte_val(pte) & _PAGE_USER) | ||
410 | #define pte_exec(pte) (pte_val(pte) & _PAGE_USER) | ||
411 | #define pte_write(pte) (pte_val(pte) & _PAGE_RW) | 407 | #define pte_write(pte) (pte_val(pte) & _PAGE_RW) |
412 | #endif | 408 | #endif |
413 | 409 | ||
@@ -420,20 +416,12 @@ static inline pte_t pte_##fn(pte_t pte) { pte.pte_##h op; return pte; } | |||
420 | * individually toggled (and user permissions are entirely decoupled from | 416 | * individually toggled (and user permissions are entirely decoupled from |
421 | * kernel permissions), we attempt to couple them a bit more sanely here. | 417 | * kernel permissions), we attempt to couple them a bit more sanely here. |
422 | */ | 418 | */ |
423 | PTE_BIT_FUNC(high, rdprotect, &= ~_PAGE_EXT_USER_READ); | ||
424 | PTE_BIT_FUNC(high, mkread, |= _PAGE_EXT_USER_READ | _PAGE_EXT_KERN_READ); | ||
425 | PTE_BIT_FUNC(high, wrprotect, &= ~_PAGE_EXT_USER_WRITE); | 419 | PTE_BIT_FUNC(high, wrprotect, &= ~_PAGE_EXT_USER_WRITE); |
426 | PTE_BIT_FUNC(high, mkwrite, |= _PAGE_EXT_USER_WRITE | _PAGE_EXT_KERN_WRITE); | 420 | PTE_BIT_FUNC(high, mkwrite, |= _PAGE_EXT_USER_WRITE | _PAGE_EXT_KERN_WRITE); |
427 | PTE_BIT_FUNC(high, exprotect, &= ~_PAGE_EXT_USER_EXEC); | ||
428 | PTE_BIT_FUNC(high, mkexec, |= _PAGE_EXT_USER_EXEC | _PAGE_EXT_KERN_EXEC); | ||
429 | PTE_BIT_FUNC(high, mkhuge, |= _PAGE_SZHUGE); | 421 | PTE_BIT_FUNC(high, mkhuge, |= _PAGE_SZHUGE); |
430 | #else | 422 | #else |
431 | PTE_BIT_FUNC(low, rdprotect, &= ~_PAGE_USER); | ||
432 | PTE_BIT_FUNC(low, mkread, |= _PAGE_USER); | ||
433 | PTE_BIT_FUNC(low, wrprotect, &= ~_PAGE_RW); | 423 | PTE_BIT_FUNC(low, wrprotect, &= ~_PAGE_RW); |
434 | PTE_BIT_FUNC(low, mkwrite, |= _PAGE_RW); | 424 | PTE_BIT_FUNC(low, mkwrite, |= _PAGE_RW); |
435 | PTE_BIT_FUNC(low, exprotect, &= ~_PAGE_USER); | ||
436 | PTE_BIT_FUNC(low, mkexec, |= _PAGE_USER); | ||
437 | PTE_BIT_FUNC(low, mkhuge, |= _PAGE_SZHUGE); | 425 | PTE_BIT_FUNC(low, mkhuge, |= _PAGE_SZHUGE); |
438 | #endif | 426 | #endif |
439 | 427 | ||
diff --git a/include/asm-sh64/pgtable.h b/include/asm-sh64/pgtable.h index b875482eb592..3488fe32e436 100644 --- a/include/asm-sh64/pgtable.h +++ b/include/asm-sh64/pgtable.h | |||
@@ -415,22 +415,15 @@ extern void __handle_bad_pmd_kernel(pmd_t * pmd); | |||
415 | /* | 415 | /* |
416 | * The following have defined behavior only work if pte_present() is true. | 416 | * The following have defined behavior only work if pte_present() is true. |
417 | */ | 417 | */ |
418 | static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_READ; } | ||
419 | static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_EXECUTE; } | ||
420 | static inline int pte_dirty(pte_t pte){ return pte_val(pte) & _PAGE_DIRTY; } | 418 | static inline int pte_dirty(pte_t pte){ return pte_val(pte) & _PAGE_DIRTY; } |
421 | static inline int pte_young(pte_t pte){ return pte_val(pte) & _PAGE_ACCESSED; } | 419 | static inline int pte_young(pte_t pte){ return pte_val(pte) & _PAGE_ACCESSED; } |
422 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } | 420 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } |
423 | static inline int pte_write(pte_t pte){ return pte_val(pte) & _PAGE_WRITE; } | 421 | static inline int pte_write(pte_t pte){ return pte_val(pte) & _PAGE_WRITE; } |
424 | 422 | ||
425 | static inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_READ)); return pte; } | ||
426 | static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_WRITE)); return pte; } | 423 | static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_WRITE)); return pte; } |
427 | static inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_EXECUTE)); return pte; } | ||
428 | static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } | 424 | static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } |
429 | static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; } | 425 | static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; } |
430 | |||
431 | static inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_READ)); return pte; } | ||
432 | static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_WRITE)); return pte; } | 426 | static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_WRITE)); return pte; } |
433 | static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_EXECUTE)); return pte; } | ||
434 | static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } | 427 | static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } |
435 | static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } | 428 | static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } |
436 | static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_SZHUGE)); return pte; } | 429 | static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_SZHUGE)); return pte; } |
diff --git a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h index 59229aeba27b..a55f4c3488b0 100644 --- a/include/asm-sparc/pgtable.h +++ b/include/asm-sparc/pgtable.h | |||
@@ -151,7 +151,6 @@ BTFIXUPDEF_CALL_CONST(unsigned long, pgd_page_vaddr, pgd_t) | |||
151 | BTFIXUPDEF_SETHI(none_mask) | 151 | BTFIXUPDEF_SETHI(none_mask) |
152 | BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t) | 152 | BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t) |
153 | BTFIXUPDEF_CALL(void, pte_clear, pte_t *) | 153 | BTFIXUPDEF_CALL(void, pte_clear, pte_t *) |
154 | BTFIXUPDEF_CALL(int, pte_read, pte_t) | ||
155 | 154 | ||
156 | static inline int pte_none(pte_t pte) | 155 | static inline int pte_none(pte_t pte) |
157 | { | 156 | { |
@@ -160,7 +159,6 @@ static inline int pte_none(pte_t pte) | |||
160 | 159 | ||
161 | #define pte_present(pte) BTFIXUP_CALL(pte_present)(pte) | 160 | #define pte_present(pte) BTFIXUP_CALL(pte_present)(pte) |
162 | #define pte_clear(mm,addr,pte) BTFIXUP_CALL(pte_clear)(pte) | 161 | #define pte_clear(mm,addr,pte) BTFIXUP_CALL(pte_clear)(pte) |
163 | #define pte_read(pte) BTFIXUP_CALL(pte_read)(pte) | ||
164 | 162 | ||
165 | BTFIXUPDEF_CALL_CONST(int, pmd_bad, pmd_t) | 163 | BTFIXUPDEF_CALL_CONST(int, pmd_bad, pmd_t) |
166 | BTFIXUPDEF_CALL_CONST(int, pmd_present, pmd_t) | 164 | BTFIXUPDEF_CALL_CONST(int, pmd_present, pmd_t) |
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h index 9e80ad43b29c..0393380d754a 100644 --- a/include/asm-sparc64/pgtable.h +++ b/include/asm-sparc64/pgtable.h | |||
@@ -573,24 +573,6 @@ static inline unsigned long pte_exec(pte_t pte) | |||
573 | return (pte_val(pte) & mask); | 573 | return (pte_val(pte) & mask); |
574 | } | 574 | } |
575 | 575 | ||
576 | static inline unsigned long pte_read(pte_t pte) | ||
577 | { | ||
578 | unsigned long mask; | ||
579 | |||
580 | __asm__ __volatile__( | ||
581 | "\n661: mov %1, %0\n" | ||
582 | " nop\n" | ||
583 | " .section .sun4v_2insn_patch, \"ax\"\n" | ||
584 | " .word 661b\n" | ||
585 | " sethi %%uhi(%2), %0\n" | ||
586 | " sllx %0, 32, %0\n" | ||
587 | " .previous\n" | ||
588 | : "=r" (mask) | ||
589 | : "i" (_PAGE_READ_4U), "i" (_PAGE_READ_4V)); | ||
590 | |||
591 | return (pte_val(pte) & mask); | ||
592 | } | ||
593 | |||
594 | static inline unsigned long pte_file(pte_t pte) | 576 | static inline unsigned long pte_file(pte_t pte) |
595 | { | 577 | { |
596 | unsigned long val = pte_val(pte); | 578 | unsigned long val = pte_val(pte); |
diff --git a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h index 1b1090a91a58..830fc6e5d49d 100644 --- a/include/asm-um/pgtable.h +++ b/include/asm-um/pgtable.h | |||
@@ -175,12 +175,6 @@ static inline int pte_none(pte_t pte) | |||
175 | * The following only work if pte_present() is true. | 175 | * The following only work if pte_present() is true. |
176 | * Undefined behaviour if not.. | 176 | * Undefined behaviour if not.. |
177 | */ | 177 | */ |
178 | static inline int pte_user(pte_t pte) | ||
179 | { | ||
180 | return((pte_get_bits(pte, _PAGE_USER)) && | ||
181 | !(pte_get_bits(pte, _PAGE_PROTNONE))); | ||
182 | } | ||
183 | |||
184 | static inline int pte_read(pte_t pte) | 178 | static inline int pte_read(pte_t pte) |
185 | { | 179 | { |
186 | return((pte_get_bits(pte, _PAGE_USER)) && | 180 | return((pte_get_bits(pte, _PAGE_USER)) && |
@@ -238,18 +232,6 @@ static inline pte_t pte_mknewprot(pte_t pte) | |||
238 | return(pte); | 232 | return(pte); |
239 | } | 233 | } |
240 | 234 | ||
241 | static inline pte_t pte_rdprotect(pte_t pte) | ||
242 | { | ||
243 | pte_clear_bits(pte, _PAGE_USER); | ||
244 | return(pte_mknewprot(pte)); | ||
245 | } | ||
246 | |||
247 | static inline pte_t pte_exprotect(pte_t pte) | ||
248 | { | ||
249 | pte_clear_bits(pte, _PAGE_USER); | ||
250 | return(pte_mknewprot(pte)); | ||
251 | } | ||
252 | |||
253 | static inline pte_t pte_mkclean(pte_t pte) | 235 | static inline pte_t pte_mkclean(pte_t pte) |
254 | { | 236 | { |
255 | pte_clear_bits(pte, _PAGE_DIRTY); | 237 | pte_clear_bits(pte, _PAGE_DIRTY); |
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h index 0a71e0b9a619..4f169ac6b10a 100644 --- a/include/asm-x86_64/pgtable.h +++ b/include/asm-x86_64/pgtable.h | |||
@@ -266,21 +266,15 @@ static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot) | |||
266 | * Undefined behaviour if not.. | 266 | * Undefined behaviour if not.. |
267 | */ | 267 | */ |
268 | #define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT) | 268 | #define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT) |
269 | static inline int pte_user(pte_t pte) { return pte_val(pte) & _PAGE_USER; } | ||
270 | static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; } | ||
271 | static inline int pte_exec(pte_t pte) { return !(pte_val(pte) & _PAGE_NX); } | ||
272 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } | 269 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } |
273 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } | 270 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } |
274 | static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } | 271 | static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } |
275 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } | 272 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } |
276 | static inline int pte_huge(pte_t pte) { return pte_val(pte) & _PAGE_PSE; } | 273 | static inline int pte_huge(pte_t pte) { return pte_val(pte) & _PAGE_PSE; } |
277 | 274 | ||
278 | static inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } | ||
279 | static inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } | ||
280 | static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } | 275 | static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } |
281 | static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; } | 276 | static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; } |
282 | static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; } | 277 | static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; } |
283 | static inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; } | ||
284 | static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_NX)); return pte; } | 278 | static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_NX)); return pte; } |
285 | static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } | 279 | static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } |
286 | static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } | 280 | static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } |
diff --git a/include/asm-xtensa/pgtable.h b/include/asm-xtensa/pgtable.h index 2d4b5db6ea63..e9fc512cc247 100644 --- a/include/asm-xtensa/pgtable.h +++ b/include/asm-xtensa/pgtable.h | |||
@@ -197,16 +197,13 @@ extern pgd_t swapper_pg_dir[PAGE_SIZE/sizeof(pgd_t)]; | |||
197 | 197 | ||
198 | /* Note: We use the _PAGE_USER bit to indicate write-protect kernel memory */ | 198 | /* Note: We use the _PAGE_USER bit to indicate write-protect kernel memory */ |
199 | 199 | ||
200 | static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; } | ||
201 | static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } | 200 | static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } |
202 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } | 201 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } |
203 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } | 202 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } |
204 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } | 203 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } |
205 | static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~(_PAGE_RW | _PAGE_WRENABLE); return pte; } | 204 | static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~(_PAGE_RW | _PAGE_WRENABLE); return pte; } |
206 | static inline pte_t pte_rdprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_USER; return pte; } | ||
207 | static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } | 205 | static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } |
208 | static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } | 206 | static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } |
209 | static inline pte_t pte_mkread(pte_t pte) { pte_val(pte) |= _PAGE_USER; return pte; } | ||
210 | static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } | 207 | static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } |
211 | static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } | 208 | static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } |
212 | static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_RW; return pte; } | 209 | static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_RW; return pte; } |