aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/asm-arm/pgtable.h6
-rw-r--r--include/asm-generic/pgtable.h19
-rw-r--r--include/asm-i386/pgtable.h11
-rw-r--r--include/asm-ia64/pgtable.h6
-rw-r--r--include/asm-s390/pgtable.h43
5 files changed, 26 insertions, 59 deletions
diff --git a/include/asm-arm/pgtable.h b/include/asm-arm/pgtable.h
index cb4c2c9d000a..d2e8171d1d4e 100644
--- a/include/asm-arm/pgtable.h
+++ b/include/asm-arm/pgtable.h
@@ -83,14 +83,14 @@
83 * means that a write to a clean page will cause a permission fault, and 83 * means that a write to a clean page will cause a permission fault, and
84 * the Linux MM layer will mark the page dirty via handle_pte_fault(). 84 * the Linux MM layer will mark the page dirty via handle_pte_fault().
85 * For the hardware to notice the permission change, the TLB entry must 85 * For the hardware to notice the permission change, the TLB entry must
86 * be flushed, and ptep_establish() does that for us. 86 * be flushed, and ptep_set_access_flags() does that for us.
87 * 87 *
88 * The "accessed" or "young" bit is emulated by a similar method; we only 88 * The "accessed" or "young" bit is emulated by a similar method; we only
89 * allow accesses to the page if the "young" bit is set. Accesses to the 89 * allow accesses to the page if the "young" bit is set. Accesses to the
90 * page will cause a fault, and handle_pte_fault() will set the young bit 90 * page will cause a fault, and handle_pte_fault() will set the young bit
91 * for us as long as the page is marked present in the corresponding Linux 91 * for us as long as the page is marked present in the corresponding Linux
92 * PTE entry. Again, ptep_establish() will ensure that the TLB is up to 92 * PTE entry. Again, ptep_set_access_flags() will ensure that the TLB is
93 * date. 93 * up to date.
94 * 94 *
95 * However, when the "young" bit is cleared, we deny access to the page 95 * However, when the "young" bit is cleared, we deny access to the page
96 * by clearing the hardware PTE. Currently Linux does not flush the TLB 96 * by clearing the hardware PTE. Currently Linux does not flush the TLB
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 7d7bcf990e99..aa3f1202a177 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -3,25 +3,6 @@
3 3
4#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
5 5
6#ifndef __HAVE_ARCH_PTEP_ESTABLISH
7/*
8 * Establish a new mapping:
9 * - flush the old one
10 * - update the page tables
11 * - inform the TLB about the new one
12 *
13 * We hold the mm semaphore for reading, and the pte lock.
14 *
15 * Note: the old pte is known to not be writable, so we don't need to
16 * worry about dirty bits etc getting lost.
17 */
18#define ptep_establish(__vma, __address, __ptep, __entry) \
19do { \
20 set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry); \
21 flush_tlb_page(__vma, __address); \
22} while (0)
23#endif
24
25#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS 6#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
26/* 7/*
27 * Largely same as above, but only sets the access flags (dirty, 8 * Largely same as above, but only sets the access flags (dirty,
diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h
index 01734e05e63b..afb1597ec173 100644
--- a/include/asm-i386/pgtable.h
+++ b/include/asm-i386/pgtable.h
@@ -311,17 +311,6 @@ static inline pte_t native_local_ptep_get_and_clear(pte_t *ptep)
311 __ret; \ 311 __ret; \
312}) 312})
313 313
314/*
315 * Rules for using ptep_establish: the pte MUST be a user pte, and
316 * must be a present->present transition.
317 */
318#define __HAVE_ARCH_PTEP_ESTABLISH
319#define ptep_establish(vma, address, ptep, pteval) \
320do { \
321 set_pte_present((vma)->vm_mm, address, ptep, pteval); \
322 flush_tlb_page(vma, address); \
323} while (0)
324
325#define __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH 314#define __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH
326#define ptep_clear_flush_dirty(vma, address, ptep) \ 315#define ptep_clear_flush_dirty(vma, address, ptep) \
327({ \ 316({ \
diff --git a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h
index f923d811c421..47642e06b920 100644
--- a/include/asm-ia64/pgtable.h
+++ b/include/asm-ia64/pgtable.h
@@ -543,8 +543,10 @@ extern void lazy_mmu_prot_update (pte_t pte);
543# define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __safely_writable) \ 543# define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __safely_writable) \
544({ \ 544({ \
545 int __changed = !pte_same(*(__ptep), __entry); \ 545 int __changed = !pte_same(*(__ptep), __entry); \
546 if (__changed) \ 546 if (__changed) { \
547 ptep_establish(__vma, __addr, __ptep, __entry); \ 547 set_pte_at((__vma)->vm_mm, (__addr), __ptep, __entry); \
548 flush_tlb_page(__vma, __addr); \
549 } \
548 __changed; \ 550 __changed; \
549}) 551})
550#endif 552#endif
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h
index 26215a976127..1039bf6b657f 100644
--- a/include/asm-s390/pgtable.h
+++ b/include/asm-s390/pgtable.h
@@ -707,16 +707,19 @@ static inline void __ptep_ipte(unsigned long address, pte_t *ptep)
707 pte_val(*ptep) = _PAGE_TYPE_EMPTY; 707 pte_val(*ptep) = _PAGE_TYPE_EMPTY;
708} 708}
709 709
710static inline pte_t 710static inline void ptep_invalidate(unsigned long address, pte_t *ptep)
711ptep_clear_flush(struct vm_area_struct *vma,
712 unsigned long address, pte_t *ptep)
713{ 711{
714 pte_t pte = *ptep;
715 pte_t *shadow_pte = get_shadow_pte(ptep);
716
717 __ptep_ipte(address, ptep); 712 __ptep_ipte(address, ptep);
718 if (shadow_pte) 713 ptep = get_shadow_pte(ptep);
719 __ptep_ipte(address, shadow_pte); 714 if (ptep)
715 __ptep_ipte(address, ptep);
716}
717
718static inline pte_t ptep_clear_flush(struct vm_area_struct *vma,
719 unsigned long address, pte_t *ptep)
720{
721 pte_t pte = *ptep;
722 ptep_invalidate(address, ptep);
720 return pte; 723 return pte;
721} 724}
722 725
@@ -726,21 +729,14 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
726 set_pte_at(mm, addr, ptep, pte_wrprotect(old_pte)); 729 set_pte_at(mm, addr, ptep, pte_wrprotect(old_pte));
727} 730}
728 731
729static inline void 732#define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __dirty) \
730ptep_establish(struct vm_area_struct *vma, 733({ \
731 unsigned long address, pte_t *ptep, 734 int __changed = !pte_same(*(__ptep), __entry); \
732 pte_t entry) 735 if (__changed) { \
733{ 736 ptep_invalidate(__addr, __ptep); \
734 ptep_clear_flush(vma, address, ptep); 737 set_pte_at((__vma)->vm_mm, __addr, __ptep, __entry); \
735 set_pte(ptep, entry); 738 } \
736} 739 __changed; \
737
738#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
739({ \
740 int __changed = !pte_same(*(__ptep), __entry); \
741 if (__changed) \
742 ptep_establish(__vma, __address, __ptep, __entry); \
743 __changed; \
744}) 740})
745 741
746/* 742/*
@@ -940,7 +936,6 @@ extern int remove_shared_memory(unsigned long start, unsigned long size);
940#define __HAVE_ARCH_MEMMAP_INIT 936#define __HAVE_ARCH_MEMMAP_INIT
941extern void memmap_init(unsigned long, int, unsigned long, unsigned long); 937extern void memmap_init(unsigned long, int, unsigned long, unsigned long);
942 938
943#define __HAVE_ARCH_PTEP_ESTABLISH
944#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS 939#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
945#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 940#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
946#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH 941#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH