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 * Note: the old pte is known to not be writable, so we don't need to
14 * worry about dirty bits etc getting lost.
16 #define ptep_establish(__vma, __address, __ptep, __entry) \
18 set_pte(__ptep, __entry); \
19 flush_tlb_page(__vma, __address); \
23 #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
25 * Largely same as above, but only sets the access flags (dirty,
26 * accessed, and writable). Furthermore, we know it always gets set
27 * to a "more permissive" setting, which allows most architectures
30 #define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
32 set_pte(__ptep, __entry); \
33 flush_tlb_page(__vma, __address); \
37 #ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
38 static inline int ptep_test_and_clear_young(pte_t *ptep)
43 set_pte(ptep, pte_mkold(pte));
48 #ifndef __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
49 #define ptep_clear_flush_young(__vma, __address, __ptep) \
51 int __young = ptep_test_and_clear_young(__ptep); \
53 flush_tlb_page(__vma, __address); \
58 #ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
59 static inline int ptep_test_and_clear_dirty(pte_t *ptep)
64 set_pte(ptep, pte_mkclean(pte));
69 #ifndef __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH
70 #define ptep_clear_flush_dirty(__vma, __address, __ptep) \
72 int __dirty = ptep_test_and_clear_dirty(__ptep); \
74 flush_tlb_page(__vma, __address); \
79 #ifndef __HAVE_ARCH_PTEP_GET_AND_CLEAR
80 static inline pte_t ptep_get_and_clear(pte_t *ptep)
88 #ifndef __HAVE_ARCH_PTEP_CLEAR_FLUSH
89 #define ptep_clear_flush(__vma, __address, __ptep) \
91 pte_t __pte = ptep_get_and_clear(__ptep); \
92 flush_tlb_page(__vma, __address); \
97 #ifndef __HAVE_ARCH_PTEP_SET_WRPROTECT
98 static inline void ptep_set_wrprotect(pte_t *ptep)
100 pte_t old_pte = *ptep;
101 set_pte(ptep, pte_wrprotect(old_pte));
105 #ifndef __HAVE_ARCH_PTEP_MKDIRTY
106 static inline void ptep_mkdirty(pte_t *ptep)
108 pte_t old_pte = *ptep;
109 set_pte(ptep, pte_mkdirty(old_pte));
113 #ifndef __HAVE_ARCH_PTE_SAME
114 #define pte_same(A,B) (pte_val(A) == pte_val(B))
117 #ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY
118 #define page_test_and_clear_dirty(page) (0)
121 #ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG
122 #define page_test_and_clear_young(page) (0)
125 #endif /* _ASM_GENERIC_PGTABLE_H */