1 #ifndef _ASM_GENERIC_PGTABLE_H
2 #define _ASM_GENERIC_PGTABLE_H
4 #ifndef __HAVE_ARCH_PTEP_ESTABLISH
6 * Establish a new mapping:
8 * - update the page tables
9 * - inform the TLB about the new one
11 * We hold the mm semaphore for reading and vma->vm_mm->page_table_lock
13 #define ptep_establish(__vma, __address, __ptep, __entry) \
15 set_pte(__ptep, __entry); \
16 flush_tlb_page(__vma, __address); \
20 #ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
21 static inline int ptep_test_and_clear_young(pte_t *ptep)
26 set_pte(ptep, pte_mkold(pte));
31 #ifndef __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
32 #define ptep_clear_flush_young(__vma, __address, __ptep) \
34 int __young = ptep_test_and_clear_young(__ptep); \
36 flush_tlb_page(__vma, __address); \
41 #ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
42 static inline int ptep_test_and_clear_dirty(pte_t *ptep)
47 set_pte(ptep, pte_mkclean(pte));
52 #ifndef __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH
53 #define ptep_clear_flush_dirty(__vma, __address, __ptep) \
55 int __dirty = ptep_test_and_clear_dirty(__ptep); \
57 flush_tlb_page(__vma, __address); \
62 #ifndef __HAVE_ARCH_PTEP_GET_AND_CLEAR
63 static inline pte_t ptep_get_and_clear(pte_t *ptep)
71 #ifndef __HAVE_ARCH_PTEP_CLEAR_FLUSH
72 #define ptep_clear_flush(__vma, __address, __ptep) \
74 pte_t __pte = ptep_get_and_clear(__ptep); \
75 flush_tlb_page(__vma, __address); \
80 #ifndef __HAVE_ARCH_PTEP_SET_WRPROTECT
81 static inline void ptep_set_wrprotect(pte_t *ptep)
83 pte_t old_pte = *ptep;
84 set_pte(ptep, pte_wrprotect(old_pte));
88 #ifndef __HAVE_ARCH_PTEP_MKDIRTY
89 static inline void ptep_mkdirty(pte_t *ptep)
91 pte_t old_pte = *ptep;
92 set_pte(ptep, pte_mkdirty(old_pte));
96 #ifndef __HAVE_ARCH_PTE_SAME
97 #define pte_same(A,B) (pte_val(A) == pte_val(B))
100 #ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY
101 #define page_test_and_clear_dirty(page) (0)
104 #ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG
105 #define page_test_and_clear_young(page) (0)
108 #endif /* _ASM_GENERIC_PGTABLE_H */