diff options
Diffstat (limited to 'arch/x86/include/asm/pgtable.h')
-rw-r--r-- | arch/x86/include/asm/pgtable.h | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 178205305ac0..860f1b635c40 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h | |||
@@ -242,64 +242,78 @@ static inline int pmd_large(pmd_t pte) | |||
242 | (_PAGE_PSE | _PAGE_PRESENT); | 242 | (_PAGE_PSE | _PAGE_PRESENT); |
243 | } | 243 | } |
244 | 244 | ||
245 | static inline pte_t pte_set_flags(pte_t pte, pteval_t set) | ||
246 | { | ||
247 | pteval_t v = native_pte_val(pte); | ||
248 | |||
249 | return native_make_pte(v | set); | ||
250 | } | ||
251 | |||
252 | static inline pte_t pte_clear_flags(pte_t pte, pteval_t clear) | ||
253 | { | ||
254 | pteval_t v = native_pte_val(pte); | ||
255 | |||
256 | return native_make_pte(v & ~clear); | ||
257 | } | ||
258 | |||
245 | static inline pte_t pte_mkclean(pte_t pte) | 259 | static inline pte_t pte_mkclean(pte_t pte) |
246 | { | 260 | { |
247 | return __pte(pte_val(pte) & ~_PAGE_DIRTY); | 261 | return pte_clear_flags(pte, _PAGE_DIRTY); |
248 | } | 262 | } |
249 | 263 | ||
250 | static inline pte_t pte_mkold(pte_t pte) | 264 | static inline pte_t pte_mkold(pte_t pte) |
251 | { | 265 | { |
252 | return __pte(pte_val(pte) & ~_PAGE_ACCESSED); | 266 | return pte_clear_flags(pte, _PAGE_ACCESSED); |
253 | } | 267 | } |
254 | 268 | ||
255 | static inline pte_t pte_wrprotect(pte_t pte) | 269 | static inline pte_t pte_wrprotect(pte_t pte) |
256 | { | 270 | { |
257 | return __pte(pte_val(pte) & ~_PAGE_RW); | 271 | return pte_clear_flags(pte, _PAGE_RW); |
258 | } | 272 | } |
259 | 273 | ||
260 | static inline pte_t pte_mkexec(pte_t pte) | 274 | static inline pte_t pte_mkexec(pte_t pte) |
261 | { | 275 | { |
262 | return __pte(pte_val(pte) & ~_PAGE_NX); | 276 | return pte_clear_flags(pte, _PAGE_NX); |
263 | } | 277 | } |
264 | 278 | ||
265 | static inline pte_t pte_mkdirty(pte_t pte) | 279 | static inline pte_t pte_mkdirty(pte_t pte) |
266 | { | 280 | { |
267 | return __pte(pte_val(pte) | _PAGE_DIRTY); | 281 | return pte_set_flags(pte, _PAGE_DIRTY); |
268 | } | 282 | } |
269 | 283 | ||
270 | static inline pte_t pte_mkyoung(pte_t pte) | 284 | static inline pte_t pte_mkyoung(pte_t pte) |
271 | { | 285 | { |
272 | return __pte(pte_val(pte) | _PAGE_ACCESSED); | 286 | return pte_set_flags(pte, _PAGE_ACCESSED); |
273 | } | 287 | } |
274 | 288 | ||
275 | static inline pte_t pte_mkwrite(pte_t pte) | 289 | static inline pte_t pte_mkwrite(pte_t pte) |
276 | { | 290 | { |
277 | return __pte(pte_val(pte) | _PAGE_RW); | 291 | return pte_set_flags(pte, _PAGE_RW); |
278 | } | 292 | } |
279 | 293 | ||
280 | static inline pte_t pte_mkhuge(pte_t pte) | 294 | static inline pte_t pte_mkhuge(pte_t pte) |
281 | { | 295 | { |
282 | return __pte(pte_val(pte) | _PAGE_PSE); | 296 | return pte_set_flags(pte, _PAGE_PSE); |
283 | } | 297 | } |
284 | 298 | ||
285 | static inline pte_t pte_clrhuge(pte_t pte) | 299 | static inline pte_t pte_clrhuge(pte_t pte) |
286 | { | 300 | { |
287 | return __pte(pte_val(pte) & ~_PAGE_PSE); | 301 | return pte_clear_flags(pte, _PAGE_PSE); |
288 | } | 302 | } |
289 | 303 | ||
290 | static inline pte_t pte_mkglobal(pte_t pte) | 304 | static inline pte_t pte_mkglobal(pte_t pte) |
291 | { | 305 | { |
292 | return __pte(pte_val(pte) | _PAGE_GLOBAL); | 306 | return pte_set_flags(pte, _PAGE_GLOBAL); |
293 | } | 307 | } |
294 | 308 | ||
295 | static inline pte_t pte_clrglobal(pte_t pte) | 309 | static inline pte_t pte_clrglobal(pte_t pte) |
296 | { | 310 | { |
297 | return __pte(pte_val(pte) & ~_PAGE_GLOBAL); | 311 | return pte_clear_flags(pte, _PAGE_GLOBAL); |
298 | } | 312 | } |
299 | 313 | ||
300 | static inline pte_t pte_mkspecial(pte_t pte) | 314 | static inline pte_t pte_mkspecial(pte_t pte) |
301 | { | 315 | { |
302 | return __pte(pte_val(pte) | _PAGE_SPECIAL); | 316 | return pte_set_flags(pte, _PAGE_SPECIAL); |
303 | } | 317 | } |
304 | 318 | ||
305 | extern pteval_t __supported_pte_mask; | 319 | extern pteval_t __supported_pte_mask; |