aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2007-07-16 02:38:17 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-16 12:05:36 -0400
commit45e98cdb6d365b34b7a2d849e4d8bdc264d8e6e4 (patch)
tree172a959293a2c31691a162eca6af131e3ac89da2
parent98011f569e2ae1e4ae394f6e23faa16676d50de4 (diff)
page table handling cleanup
Kill pte_rdprotect(), pte_exprotect(), pte_mkread(), pte_mkexec(), pte_read(), pte_exec(), and pte_user() except where arch-specific code is making use of them. Signed-off-by: Jan Beulich <jbeulich@novell.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Christoph Hellwig <hch@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/sparc/mm/srmmu.c4
-rw-r--r--arch/sparc/mm/sun4c.c6
-rw-r--r--include/asm-alpha/pgtable.h6
-rw-r--r--include/asm-arm/pgtable.h6
-rw-r--r--include/asm-arm26/pgtable.h4
-rw-r--r--include/asm-avr32/pgtable.h28
-rw-r--r--include/asm-cris/pgtable.h30
-rw-r--r--include/asm-frv/pgtable.h6
-rw-r--r--include/asm-i386/pgtable-2level.h8
-rw-r--r--include/asm-i386/pgtable-3level.h17
-rw-r--r--include/asm-i386/pgtable.h6
-rw-r--r--include/asm-ia64/pgtable.h3
-rw-r--r--include/asm-m32r/pgtable.h34
-rw-r--r--include/asm-m68k/motorola_pgtable.h6
-rw-r--r--include/asm-m68k/sun3_pgtable.h6
-rw-r--r--include/asm-mips/pgtable.h34
-rw-r--r--include/asm-parisc/pgtable.h4
-rw-r--r--include/asm-powerpc/pgtable-ppc32.h10
-rw-r--r--include/asm-powerpc/pgtable-ppc64.h10
-rw-r--r--include/asm-ppc/pgtable.h10
-rw-r--r--include/asm-s390/pgtable.h8
-rw-r--r--include/asm-sh/pgtable.h12
-rw-r--r--include/asm-sh64/pgtable.h7
-rw-r--r--include/asm-sparc/pgtable.h2
-rw-r--r--include/asm-sparc64/pgtable.h18
-rw-r--r--include/asm-um/pgtable.h18
-rw-r--r--include/asm-x86_64/pgtable.h6
-rw-r--r--include/asm-xtensa/pgtable.h3
28 files changed, 1 insertions, 311 deletions
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index e5eaa8072ae0..ca26232da7ab 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -160,9 +160,6 @@ static inline int srmmu_pte_none(pte_t pte)
160static inline int srmmu_pte_present(pte_t pte) 160static inline int srmmu_pte_present(pte_t pte)
161{ return ((pte_val(pte) & SRMMU_ET_MASK) == SRMMU_ET_PTE); } 161{ return ((pte_val(pte) & SRMMU_ET_MASK) == SRMMU_ET_PTE); }
162 162
163static inline int srmmu_pte_read(pte_t pte)
164{ return !(pte_val(pte) & SRMMU_NOREAD); }
165
166static inline void srmmu_pte_clear(pte_t *ptep) 163static inline void srmmu_pte_clear(pte_t *ptep)
167{ srmmu_set_pte(ptep, __pte(0)); } 164{ srmmu_set_pte(ptep, __pte(0)); }
168 165
@@ -2181,7 +2178,6 @@ void __init ld_mmu_srmmu(void)
2181 2178
2182 BTFIXUPSET_CALL(pte_present, srmmu_pte_present, BTFIXUPCALL_NORM); 2179 BTFIXUPSET_CALL(pte_present, srmmu_pte_present, BTFIXUPCALL_NORM);
2183 BTFIXUPSET_CALL(pte_clear, srmmu_pte_clear, BTFIXUPCALL_SWAPO0G0); 2180 BTFIXUPSET_CALL(pte_clear, srmmu_pte_clear, BTFIXUPCALL_SWAPO0G0);
2184 BTFIXUPSET_CALL(pte_read, srmmu_pte_read, BTFIXUPCALL_NORM);
2185 2181
2186 BTFIXUPSET_CALL(pmd_bad, srmmu_pmd_bad, BTFIXUPCALL_NORM); 2182 BTFIXUPSET_CALL(pmd_bad, srmmu_pmd_bad, BTFIXUPCALL_NORM);
2187 BTFIXUPSET_CALL(pmd_present, srmmu_pmd_present, BTFIXUPCALL_NORM); 2183 BTFIXUPSET_CALL(pmd_present, srmmu_pmd_present, BTFIXUPCALL_NORM);
diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c
index 436021ceb2e7..bdd835fba02e 100644
--- a/arch/sparc/mm/sun4c.c
+++ b/arch/sparc/mm/sun4c.c
@@ -1748,11 +1748,6 @@ static int sun4c_pte_present(pte_t pte)
1748} 1748}
1749static void sun4c_pte_clear(pte_t *ptep) { *ptep = __pte(0); } 1749static void sun4c_pte_clear(pte_t *ptep) { *ptep = __pte(0); }
1750 1750
1751static int sun4c_pte_read(pte_t pte)
1752{
1753 return (pte_val(pte) & _SUN4C_PAGE_READ);
1754}
1755
1756static int sun4c_pmd_bad(pmd_t pmd) 1751static int sun4c_pmd_bad(pmd_t pmd)
1757{ 1752{
1758 return (((pmd_val(pmd) & ~PAGE_MASK) != PGD_TABLE) || 1753 return (((pmd_val(pmd) & ~PAGE_MASK) != PGD_TABLE) ||
@@ -2212,7 +2207,6 @@ void __init ld_mmu_sun4c(void)
2212 2207
2213 BTFIXUPSET_CALL(pte_present, sun4c_pte_present, BTFIXUPCALL_NORM); 2208 BTFIXUPSET_CALL(pte_present, sun4c_pte_present, BTFIXUPCALL_NORM);
2214 BTFIXUPSET_CALL(pte_clear, sun4c_pte_clear, BTFIXUPCALL_STG0O0); 2209 BTFIXUPSET_CALL(pte_clear, sun4c_pte_clear, BTFIXUPCALL_STG0O0);
2215 BTFIXUPSET_CALL(pte_read, sun4c_pte_read, BTFIXUPCALL_NORM);
2216 2210
2217 BTFIXUPSET_CALL(pmd_bad, sun4c_pmd_bad, BTFIXUPCALL_NORM); 2211 BTFIXUPSET_CALL(pmd_bad, sun4c_pmd_bad, BTFIXUPCALL_NORM);
2218 BTFIXUPSET_CALL(pmd_present, sun4c_pmd_present, BTFIXUPCALL_NORM); 2212 BTFIXUPSET_CALL(pmd_present, sun4c_pmd_present, BTFIXUPCALL_NORM);
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 */
267extern inline int pte_read(pte_t pte) { return !(pte_val(pte) & _PAGE_FOR); }
268extern inline int pte_write(pte_t pte) { return !(pte_val(pte) & _PAGE_FOW); } 267extern inline int pte_write(pte_t pte) { return !(pte_val(pte) & _PAGE_FOW); }
269extern inline int pte_exec(pte_t pte) { return !(pte_val(pte) & _PAGE_FOE); }
270extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 268extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
271extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 269extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
272extern inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 270extern inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
273 271
274extern inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_FOW; return pte; } 272extern inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_FOW; return pte; }
275extern inline pte_t pte_rdprotect(pte_t pte) { pte_val(pte) |= _PAGE_FOR; return pte; }
276extern inline pte_t pte_exprotect(pte_t pte) { pte_val(pte) |= _PAGE_FOE; return pte; }
277extern inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~(__DIRTY_BITS); return pte; } 273extern inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~(__DIRTY_BITS); return pte; }
278extern inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~(__ACCESS_BITS); return pte; } 274extern inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~(__ACCESS_BITS); return pte; }
279extern inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) &= ~_PAGE_FOW; return pte; } 275extern inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) &= ~_PAGE_FOW; return pte; }
280extern inline pte_t pte_mkread(pte_t pte) { pte_val(pte) &= ~_PAGE_FOR; return pte; }
281extern inline pte_t pte_mkexec(pte_t pte) { pte_val(pte) &= ~_PAGE_FOE; return pte; }
282extern inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= __DIRTY_BITS; return pte; } 276extern inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= __DIRTY_BITS; return pte; }
283extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= __ACCESS_BITS; return pte; } 277extern 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) \
276static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; } 274static 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);*/
280PTE_BIT_FUNC(wrprotect, &= ~L_PTE_WRITE); 276PTE_BIT_FUNC(wrprotect, &= ~L_PTE_WRITE);
281PTE_BIT_FUNC(mkwrite, |= L_PTE_WRITE); 277PTE_BIT_FUNC(mkwrite, |= L_PTE_WRITE);
282PTE_BIT_FUNC(exprotect, &= ~L_PTE_EXEC);
283PTE_BIT_FUNC(mkexec, |= L_PTE_EXEC);
284PTE_BIT_FUNC(mkclean, &= ~L_PTE_DIRTY); 278PTE_BIT_FUNC(mkclean, &= ~L_PTE_DIRTY);
285PTE_BIT_FUNC(mkdirty, |= L_PTE_DIRTY); 279PTE_BIT_FUNC(mkdirty, |= L_PTE_DIRTY);
286PTE_BIT_FUNC(mkold, &= ~L_PTE_YOUNG); 280PTE_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
232PTE_BIT_FUNC(wrprotect, |= _PAGE_READONLY); 230PTE_BIT_FUNC(wrprotect, |= _PAGE_READONLY);
233PTE_BIT_FUNC(mkwrite, &= ~_PAGE_READONLY); 231PTE_BIT_FUNC(mkwrite, &= ~_PAGE_READONLY);
234PTE_BIT_FUNC(exprotect, |= _PAGE_NOT_USER);
235PTE_BIT_FUNC(mkexec, &= ~_PAGE_NOT_USER);
236PTE_BIT_FUNC(mkclean, |= _PAGE_CLEAN); 232PTE_BIT_FUNC(mkclean, |= _PAGE_CLEAN);
237PTE_BIT_FUNC(mkdirty, &= ~_PAGE_CLEAN); 233PTE_BIT_FUNC(mkdirty, &= ~_PAGE_CLEAN);
238PTE_BIT_FUNC(mkold, |= _PAGE_OLD); 234PTE_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 */
204static inline int pte_read(pte_t pte)
205{
206 return pte_val(pte) & _PAGE_USER;
207}
208static inline int pte_write(pte_t pte) 204static 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}
212static inline int pte_exec(pte_t pte)
213{
214 return pte_val(pte) & _PAGE_EXECUTE;
215}
216static inline int pte_dirty(pte_t pte) 208static 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 */
234static inline pte_t pte_rdprotect(pte_t pte)
235{
236 set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER));
237 return pte;
238}
239static inline pte_t pte_wrprotect(pte_t pte) 226static 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}
244static inline pte_t pte_exprotect(pte_t pte)
245{
246 set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_EXECUTE));
247 return pte;
248}
249static inline pte_t pte_mkclean(pte_t pte) 231static 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}
259static inline pte_t pte_mkread(pte_t pte)
260{
261 set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER));
262 return pte;
263}
264static inline pte_t pte_mkwrite(pte_t pte) 241static 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}
269static inline pte_t pte_mkexec(pte_t pte)
270{
271 set_pte(&pte, __pte(pte_val(pte) | _PAGE_EXECUTE));
272 return pte;
273}
274static inline pte_t pte_mkdirty(pte_t pte) 246static 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
114static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_READ; }
115static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } 114static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; }
116static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_READ; }
117static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; } 115static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; }
118static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 116static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
119static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 117static 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
127static inline pte_t pte_rdprotect(pte_t pte)
128{
129 pte_val(pte) &= ~(_PAGE_READ | _PAGE_SILENT_READ);
130 return pte;
131}
132
133static inline pte_t pte_exprotect(pte_t pte)
134{
135 pte_val(pte) &= ~(_PAGE_READ | _PAGE_SILENT_READ);
136 return pte;
137}
138
139static inline pte_t pte_mkclean(pte_t pte) 125static 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
159static 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
167static 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
175static inline pte_t pte_mkdirty(pte_t pte) 145static 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 */
380static inline int pte_read(pte_t pte) { return !((pte).pte & _PAGE_SUPER); }
381static inline int pte_exec(pte_t pte) { return !((pte).pte & _PAGE_SUPER); }
382static inline int pte_dirty(pte_t pte) { return (pte).pte & _PAGE_DIRTY; } 380static inline int pte_dirty(pte_t pte) { return (pte).pte & _PAGE_DIRTY; }
383static inline int pte_young(pte_t pte) { return (pte).pte & _PAGE_ACCESSED; } 381static inline int pte_young(pte_t pte) { return (pte).pte & _PAGE_ACCESSED; }
384static inline int pte_write(pte_t pte) { return !((pte).pte & _PAGE_WP); } 382static inline int pte_write(pte_t pte) { return !((pte).pte & _PAGE_WP); }
385 383
386static inline pte_t pte_rdprotect(pte_t pte) { (pte).pte |= _PAGE_SUPER; return pte; }
387static inline pte_t pte_exprotect(pte_t pte) { (pte).pte |= _PAGE_SUPER; return pte; }
388static inline pte_t pte_mkclean(pte_t pte) { (pte).pte &= ~_PAGE_DIRTY; return pte; } 384static inline pte_t pte_mkclean(pte_t pte) { (pte).pte &= ~_PAGE_DIRTY; return pte; }
389static inline pte_t pte_mkold(pte_t pte) { (pte).pte &= ~_PAGE_ACCESSED; return pte; } 385static inline pte_t pte_mkold(pte_t pte) { (pte).pte &= ~_PAGE_ACCESSED; return pte; }
390static inline pte_t pte_wrprotect(pte_t pte) { (pte).pte |= _PAGE_WP; return pte; } 386static inline pte_t pte_wrprotect(pte_t pte) { (pte).pte |= _PAGE_WP; return pte; }
391static inline pte_t pte_mkread(pte_t pte) { (pte).pte &= ~_PAGE_SUPER; return pte; }
392static inline pte_t pte_mkexec(pte_t pte) { (pte).pte &= ~_PAGE_SUPER; return pte; }
393static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte |= _PAGE_DIRTY; return pte; } 387static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte |= _PAGE_DIRTY; return pte; }
394static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte |= _PAGE_ACCESSED; return pte; } 388static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte |= _PAGE_ACCESSED; return pte; }
395static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte &= ~_PAGE_WP; return pte; } 389static 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 */
62static 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 */
70static inline int pte_exec_kernel(pte_t pte) 62static 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 */
25static 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 */
33static 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 */
40static inline int pte_exec_kernel(pte_t pte) 25static 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 */
221static inline int pte_user(pte_t pte) { return (pte).pte_low & _PAGE_USER; }
222static inline int pte_read(pte_t pte) { return (pte).pte_low & _PAGE_USER; }
223static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_DIRTY; } 221static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_DIRTY; }
224static inline int pte_young(pte_t pte) { return (pte).pte_low & _PAGE_ACCESSED; } 222static inline int pte_young(pte_t pte) { return (pte).pte_low & _PAGE_ACCESSED; }
225static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_RW; } 223static 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 */
231static inline int pte_file(pte_t pte) { return (pte).pte_low & _PAGE_FILE; } 229static inline int pte_file(pte_t pte) { return (pte).pte_low & _PAGE_FILE; }
232 230
233static inline pte_t pte_rdprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_USER; return pte; }
234static inline pte_t pte_exprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_USER; return pte; }
235static inline pte_t pte_mkclean(pte_t pte) { (pte).pte_low &= ~_PAGE_DIRTY; return pte; } 231static inline pte_t pte_mkclean(pte_t pte) { (pte).pte_low &= ~_PAGE_DIRTY; return pte; }
236static inline pte_t pte_mkold(pte_t pte) { (pte).pte_low &= ~_PAGE_ACCESSED; return pte; } 232static inline pte_t pte_mkold(pte_t pte) { (pte).pte_low &= ~_PAGE_ACCESSED; return pte; }
237static inline pte_t pte_wrprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_RW; return pte; } 233static inline pte_t pte_wrprotect(pte_t pte) { (pte).pte_low &= ~_PAGE_RW; return pte; }
238static inline pte_t pte_mkread(pte_t pte) { (pte).pte_low |= _PAGE_USER; return pte; }
239static inline pte_t pte_mkexec(pte_t pte) { (pte).pte_low |= _PAGE_USER; return pte; }
240static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte_low |= _PAGE_DIRTY; return pte; } 234static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte_low |= _PAGE_DIRTY; return pte; }
241static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; return pte; } 235static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; return pte; }
242static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; } 236static 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 */
194static inline int pte_read(pte_t pte)
195{
196 return pte_val(pte) & _PAGE_READ;
197}
198
199static inline int pte_exec(pte_t pte)
200{
201 return pte_val(pte) & _PAGE_EXEC;
202}
203
204static inline int pte_dirty(pte_t pte) 194static 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
227static inline pte_t pte_rdprotect(pte_t pte)
228{
229 pte_val(pte) &= ~_PAGE_READ;
230 return pte;
231}
232
233static inline pte_t pte_exprotect(pte_t pte)
234{
235 pte_val(pte) &= ~_PAGE_EXEC;
236 return pte;
237}
238
239static inline pte_t pte_mkclean(pte_t pte) 217static 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
257static inline pte_t pte_mkread(pte_t pte)
258{
259 pte_val(pte) |= _PAGE_READ;
260 return pte;
261}
262
263static inline pte_t pte_mkexec(pte_t pte)
264{
265 pte_val(pte) |= _PAGE_EXEC;
266 return pte;
267}
268
269static inline pte_t pte_mkdirty(pte_t pte) 235static 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 */
167static inline int pte_read(pte_t pte) { return 1; }
168static inline int pte_write(pte_t pte) { return !(pte_val(pte) & _PAGE_RONLY); } 167static inline int pte_write(pte_t pte) { return !(pte_val(pte) & _PAGE_RONLY); }
169static inline int pte_exec(pte_t pte) { return 1; }
170static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 168static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
171static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 169static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
172static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 170static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
173 171
174static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_RONLY; return pte; } 172static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_RONLY; return pte; }
175static inline pte_t pte_rdprotect(pte_t pte) { return pte; }
176static inline pte_t pte_exprotect(pte_t pte) { return pte; }
177static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } 173static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; }
178static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } 174static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; }
179static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) &= ~_PAGE_RONLY; return pte; } 175static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) &= ~_PAGE_RONLY; return pte; }
180static inline pte_t pte_mkread(pte_t pte) { return pte; }
181static inline pte_t pte_mkexec(pte_t pte) { return pte; }
182static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } 176static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; }
183static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } 177static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; }
184static inline pte_t pte_mknocache(pte_t pte) 178static 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 */
168static inline int pte_read(pte_t pte) { return 1; }
169static inline int pte_write(pte_t pte) { return pte_val(pte) & SUN3_PAGE_WRITEABLE; } 168static inline int pte_write(pte_t pte) { return pte_val(pte) & SUN3_PAGE_WRITEABLE; }
170static inline int pte_exec(pte_t pte) { return 1; }
171static inline int pte_dirty(pte_t pte) { return pte_val(pte) & SUN3_PAGE_MODIFIED; } 169static inline int pte_dirty(pte_t pte) { return pte_val(pte) & SUN3_PAGE_MODIFIED; }
172static inline int pte_young(pte_t pte) { return pte_val(pte) & SUN3_PAGE_ACCESSED; } 170static inline int pte_young(pte_t pte) { return pte_val(pte) & SUN3_PAGE_ACCESSED; }
173static inline int pte_file(pte_t pte) { return pte_val(pte) & SUN3_PAGE_ACCESSED; } 171static inline int pte_file(pte_t pte) { return pte_val(pte) & SUN3_PAGE_ACCESSED; }
174 172
175static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_WRITEABLE; return pte; } 173static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_WRITEABLE; return pte; }
176static inline pte_t pte_rdprotect(pte_t pte) { return pte; }
177static inline pte_t pte_exprotect(pte_t pte) { return pte; }
178static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_MODIFIED; return pte; } 174static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_MODIFIED; return pte; }
179static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_ACCESSED; return pte; } 175static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_ACCESSED; return pte; }
180static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= SUN3_PAGE_WRITEABLE; return pte; } 176static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= SUN3_PAGE_WRITEABLE; return pte; }
181static inline pte_t pte_mkread(pte_t pte) { return pte; }
182static inline pte_t pte_mkexec(pte_t pte) { return pte; }
183static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= SUN3_PAGE_MODIFIED; return pte; } 177static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= SUN3_PAGE_MODIFIED; return pte; }
184static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= SUN3_PAGE_ACCESSED; return pte; } 178static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= SUN3_PAGE_ACCESSED; return pte; }
185static inline pte_t pte_mknocache(pte_t pte) { pte_val(pte) |= SUN3_PAGE_NOCACHE; return pte; } 179static 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 */
181static 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)
183static inline int pte_read(pte_t pte) { return pte.pte_low & _PAGE_READ; }
184static inline int pte_write(pte_t pte) { return pte.pte_low & _PAGE_WRITE; } 182static inline int pte_write(pte_t pte) { return pte.pte_low & _PAGE_WRITE; }
185static inline int pte_dirty(pte_t pte) { return pte.pte_low & _PAGE_MODIFIED; } 183static inline int pte_dirty(pte_t pte) { return pte.pte_low & _PAGE_MODIFIED; }
186static inline int pte_young(pte_t pte) { return pte.pte_low & _PAGE_ACCESSED; } 184static 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
196static 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
203static inline pte_t pte_mkclean(pte_t pte) 194static 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
227static 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
237static inline pte_t pte_mkdirty(pte_t pte) 218static 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
256static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_READ; }
257static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } 237static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; }
258static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; } 238static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; }
259static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 239static 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
268static inline pte_t pte_rdprotect(pte_t pte)
269{
270 pte_val(pte) &= ~(_PAGE_READ | _PAGE_SILENT_READ);
271 return pte;
272}
273
274static inline pte_t pte_mkclean(pte_t pte) 248static 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
294static 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
302static inline pte_t pte_mkdirty(pte_t pte) 268static 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 */
338extern inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_READ; }
339extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 338extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
340extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 339extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
341extern inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } 340extern inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; }
342extern inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 341extern inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
343extern inline int pte_user(pte_t pte) { return pte_val(pte) & _PAGE_USER; }
344 342
345extern inline pte_t pte_rdprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_READ; return pte; }
346extern inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } 343extern inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; }
347extern inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } 344extern inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; }
348extern inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_WRITE; return pte; } 345extern inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_WRITE; return pte; }
349extern inline pte_t pte_mkread(pte_t pte) { pte_val(pte) |= _PAGE_READ; return pte; }
350extern inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } 346extern inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; }
351extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } 347extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; }
352extern inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_WRITE; return pte; } 348extern 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 */
515static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; }
516static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } 515static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; }
517static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_EXEC; }
518static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 516static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
519static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 517static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
520static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 518static 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; }
522static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } 520static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; }
523static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } 521static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; }
524 522
525static inline pte_t pte_rdprotect(pte_t pte) {
526 pte_val(pte) &= ~_PAGE_USER; return pte; }
527static inline pte_t pte_wrprotect(pte_t pte) { 523static 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; }
529static inline pte_t pte_exprotect(pte_t pte) {
530 pte_val(pte) &= ~_PAGE_EXEC; return pte; }
531static inline pte_t pte_mkclean(pte_t pte) { 525static 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; }
533static inline pte_t pte_mkold(pte_t pte) { 527static 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
536static inline pte_t pte_mkread(pte_t pte) {
537 pte_val(pte) |= _PAGE_USER; return pte; }
538static inline pte_t pte_mkexec(pte_t pte) {
539 pte_val(pte) |= _PAGE_USER | _PAGE_EXEC; return pte; }
540static inline pte_t pte_mkwrite(pte_t pte) { 530static inline pte_t pte_mkwrite(pte_t pte) {
541 pte_val(pte) |= _PAGE_RW; return pte; } 531 pte_val(pte) |= _PAGE_RW; return pte; }
542static inline pte_t pte_mkdirty(pte_t pte) { 532static 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 */
235static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER;}
236static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW;} 235static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW;}
237static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_EXEC;}
238static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY;} 236static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY;}
239static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED;} 237static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED;}
240static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE;} 238static 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;}
242static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } 240static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; }
243static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } 241static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; }
244 242
245static inline pte_t pte_rdprotect(pte_t pte) {
246 pte_val(pte) &= ~_PAGE_USER; return pte; }
247static inline pte_t pte_exprotect(pte_t pte) {
248 pte_val(pte) &= ~_PAGE_EXEC; return pte; }
249static inline pte_t pte_wrprotect(pte_t pte) { 243static inline pte_t pte_wrprotect(pte_t pte) {
250 pte_val(pte) &= ~(_PAGE_RW); return pte; } 244 pte_val(pte) &= ~(_PAGE_RW); return pte; }
251static inline pte_t pte_mkclean(pte_t pte) { 245static inline pte_t pte_mkclean(pte_t pte) {
252 pte_val(pte) &= ~(_PAGE_DIRTY); return pte; } 246 pte_val(pte) &= ~(_PAGE_DIRTY); return pte; }
253static inline pte_t pte_mkold(pte_t pte) { 247static inline pte_t pte_mkold(pte_t pte) {
254 pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } 248 pte_val(pte) &= ~_PAGE_ACCESSED; return pte; }
255static inline pte_t pte_mkread(pte_t pte) {
256 pte_val(pte) |= _PAGE_USER; return pte; }
257static inline pte_t pte_mkexec(pte_t pte) {
258 pte_val(pte) |= _PAGE_USER | _PAGE_EXEC; return pte; }
259static inline pte_t pte_mkwrite(pte_t pte) { 249static inline pte_t pte_mkwrite(pte_t pte) {
260 pte_val(pte) |= _PAGE_RW; return pte; } 250 pte_val(pte) |= _PAGE_RW; return pte; }
261static inline pte_t pte_mkdirty(pte_t pte) { 251static 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 */
536static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; }
537static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } 536static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; }
538static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_EXEC; }
539static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 537static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
540static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 538static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
541static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 539static 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; }
543static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } 541static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; }
544static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } 542static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; }
545 543
546static inline pte_t pte_rdprotect(pte_t pte) {
547 pte_val(pte) &= ~_PAGE_USER; return pte; }
548static inline pte_t pte_wrprotect(pte_t pte) { 544static 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; }
550static inline pte_t pte_exprotect(pte_t pte) {
551 pte_val(pte) &= ~_PAGE_EXEC; return pte; }
552static inline pte_t pte_mkclean(pte_t pte) { 546static 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; }
554static inline pte_t pte_mkold(pte_t pte) { 548static 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
557static inline pte_t pte_mkread(pte_t pte) {
558 pte_val(pte) |= _PAGE_USER; return pte; }
559static inline pte_t pte_mkexec(pte_t pte) {
560 pte_val(pte) |= _PAGE_USER | _PAGE_EXEC; return pte; }
561static inline pte_t pte_mkwrite(pte_t pte) { 551static inline pte_t pte_mkwrite(pte_t pte) {
562 pte_val(pte) |= _PAGE_RW; return pte; } 552 pte_val(pte) |= _PAGE_RW; return pte; }
563static inline pte_t pte_mkdirty(pte_t pte) { 553static 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
533static 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 */
423PTE_BIT_FUNC(high, rdprotect, &= ~_PAGE_EXT_USER_READ);
424PTE_BIT_FUNC(high, mkread, |= _PAGE_EXT_USER_READ | _PAGE_EXT_KERN_READ);
425PTE_BIT_FUNC(high, wrprotect, &= ~_PAGE_EXT_USER_WRITE); 419PTE_BIT_FUNC(high, wrprotect, &= ~_PAGE_EXT_USER_WRITE);
426PTE_BIT_FUNC(high, mkwrite, |= _PAGE_EXT_USER_WRITE | _PAGE_EXT_KERN_WRITE); 420PTE_BIT_FUNC(high, mkwrite, |= _PAGE_EXT_USER_WRITE | _PAGE_EXT_KERN_WRITE);
427PTE_BIT_FUNC(high, exprotect, &= ~_PAGE_EXT_USER_EXEC);
428PTE_BIT_FUNC(high, mkexec, |= _PAGE_EXT_USER_EXEC | _PAGE_EXT_KERN_EXEC);
429PTE_BIT_FUNC(high, mkhuge, |= _PAGE_SZHUGE); 421PTE_BIT_FUNC(high, mkhuge, |= _PAGE_SZHUGE);
430#else 422#else
431PTE_BIT_FUNC(low, rdprotect, &= ~_PAGE_USER);
432PTE_BIT_FUNC(low, mkread, |= _PAGE_USER);
433PTE_BIT_FUNC(low, wrprotect, &= ~_PAGE_RW); 423PTE_BIT_FUNC(low, wrprotect, &= ~_PAGE_RW);
434PTE_BIT_FUNC(low, mkwrite, |= _PAGE_RW); 424PTE_BIT_FUNC(low, mkwrite, |= _PAGE_RW);
435PTE_BIT_FUNC(low, exprotect, &= ~_PAGE_USER);
436PTE_BIT_FUNC(low, mkexec, |= _PAGE_USER);
437PTE_BIT_FUNC(low, mkhuge, |= _PAGE_SZHUGE); 425PTE_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 */
418static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_READ; }
419static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_EXECUTE; }
420static inline int pte_dirty(pte_t pte){ return pte_val(pte) & _PAGE_DIRTY; } 418static inline int pte_dirty(pte_t pte){ return pte_val(pte) & _PAGE_DIRTY; }
421static inline int pte_young(pte_t pte){ return pte_val(pte) & _PAGE_ACCESSED; } 419static inline int pte_young(pte_t pte){ return pte_val(pte) & _PAGE_ACCESSED; }
422static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 420static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
423static inline int pte_write(pte_t pte){ return pte_val(pte) & _PAGE_WRITE; } 421static inline int pte_write(pte_t pte){ return pte_val(pte) & _PAGE_WRITE; }
424 422
425static inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_READ)); return pte; }
426static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_WRITE)); return pte; } 423static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_WRITE)); return pte; }
427static inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_EXECUTE)); return pte; }
428static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } 424static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; }
429static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; } 425static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; }
430
431static inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_READ)); return pte; }
432static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_WRITE)); return pte; } 426static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_WRITE)); return pte; }
433static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_EXECUTE)); return pte; }
434static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } 427static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; }
435static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } 428static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; }
436static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_SZHUGE)); return pte; } 429static 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)
151BTFIXUPDEF_SETHI(none_mask) 151BTFIXUPDEF_SETHI(none_mask)
152BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t) 152BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t)
153BTFIXUPDEF_CALL(void, pte_clear, pte_t *) 153BTFIXUPDEF_CALL(void, pte_clear, pte_t *)
154BTFIXUPDEF_CALL(int, pte_read, pte_t)
155 154
156static inline int pte_none(pte_t pte) 155static 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
165BTFIXUPDEF_CALL_CONST(int, pmd_bad, pmd_t) 163BTFIXUPDEF_CALL_CONST(int, pmd_bad, pmd_t)
166BTFIXUPDEF_CALL_CONST(int, pmd_present, pmd_t) 164BTFIXUPDEF_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
576static 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
594static inline unsigned long pte_file(pte_t pte) 576static 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 */
178static 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
184static inline int pte_read(pte_t pte) 178static 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
241static inline pte_t pte_rdprotect(pte_t pte)
242{
243 pte_clear_bits(pte, _PAGE_USER);
244 return(pte_mknewprot(pte));
245}
246
247static inline pte_t pte_exprotect(pte_t pte)
248{
249 pte_clear_bits(pte, _PAGE_USER);
250 return(pte_mknewprot(pte));
251}
252
253static inline pte_t pte_mkclean(pte_t pte) 235static 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)
269static inline int pte_user(pte_t pte) { return pte_val(pte) & _PAGE_USER; }
270static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; }
271static inline int pte_exec(pte_t pte) { return !(pte_val(pte) & _PAGE_NX); }
272static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 269static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
273static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 270static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
274static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } 271static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; }
275static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 272static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
276static inline int pte_huge(pte_t pte) { return pte_val(pte) & _PAGE_PSE; } 273static inline int pte_huge(pte_t pte) { return pte_val(pte) & _PAGE_PSE; }
277 274
278static inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; }
279static inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; }
280static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } 275static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; }
281static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; } 276static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; }
282static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; } 277static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; }
283static inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; }
284static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_NX)); return pte; } 278static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_NX)); return pte; }
285static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } 279static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; }
286static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } 280static 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
200static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; }
201static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } 200static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; }
202static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 201static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
203static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 202static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
204static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 203static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
205static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~(_PAGE_RW | _PAGE_WRENABLE); return pte; } 204static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~(_PAGE_RW | _PAGE_WRENABLE); return pte; }
206static inline pte_t pte_rdprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_USER; return pte; }
207static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } 205static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; }
208static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } 206static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; }
209static inline pte_t pte_mkread(pte_t pte) { pte_val(pte) |= _PAGE_USER; return pte; }
210static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } 207static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; }
211static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } 208static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; }
212static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_RW; return pte; } 209static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_RW; return pte; }