1#ifndef _ASM_GENERIC_PGTABLE_H 2#define _ASM_GENERIC_PGTABLE_H 3 4static inline int ptep_test_and_clear_young(pte_t *ptep) 5{ 6 pte_t pte = *ptep; 7 if (!pte_young(pte)) 8 return 0; 9 set_pte(ptep, pte_mkold(pte)); 10 return 1; 11} 12 13static inline int ptep_test_and_clear_dirty(pte_t *ptep) 14{ 15 pte_t pte = *ptep; 16 if (!pte_dirty(pte)) 17 return 0; 18 set_pte(ptep, pte_mkclean(pte)); 19 return 1; 20} 21 22static inline pte_t ptep_get_and_clear(pte_t *ptep) 23{ 24 pte_t pte = *ptep; 25 pte_clear(ptep); 26 return pte; 27} 28 29static inline void ptep_set_wrprotect(pte_t *ptep) 30{ 31 pte_t old_pte = *ptep; 32 set_pte(ptep, pte_wrprotect(old_pte)); 33} 34 35static inline void ptep_mkdirty(pte_t *ptep) 36{ 37 pte_t old_pte = *ptep; 38 set_pte(ptep, pte_mkdirty(old_pte)); 39} 40 41#define pte_same(A,B) (pte_val(A) == pte_val(B)) 42 43#endif /* _ASM_GENERIC_PGTABLE_H */ 44