diff options
Diffstat (limited to 'arch/sh/mm/pg-sh4.c')
-rw-r--r-- | arch/sh/mm/pg-sh4.c | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/arch/sh/mm/pg-sh4.c b/arch/sh/mm/pg-sh4.c index 3f98d2a4f936..969efeceb928 100644 --- a/arch/sh/mm/pg-sh4.c +++ b/arch/sh/mm/pg-sh4.c | |||
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | extern struct mutex p3map_mutex[]; | 14 | extern struct mutex p3map_mutex[]; |
15 | 15 | ||
16 | #define CACHE_ALIAS (cpu_data->dcache.alias_mask) | 16 | #define CACHE_ALIAS (current_cpu_data.dcache.alias_mask) |
17 | 17 | ||
18 | /* | 18 | /* |
19 | * clear_user_page | 19 | * clear_user_page |
@@ -23,7 +23,6 @@ extern struct mutex p3map_mutex[]; | |||
23 | */ | 23 | */ |
24 | void clear_user_page(void *to, unsigned long address, struct page *page) | 24 | void clear_user_page(void *to, unsigned long address, struct page *page) |
25 | { | 25 | { |
26 | __set_bit(PG_mapped, &page->flags); | ||
27 | if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) | 26 | if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) |
28 | clear_page(to); | 27 | clear_page(to); |
29 | else { | 28 | else { |
@@ -40,7 +39,7 @@ void clear_user_page(void *to, unsigned long address, struct page *page) | |||
40 | mutex_lock(&p3map_mutex[(address & CACHE_ALIAS)>>12]); | 39 | mutex_lock(&p3map_mutex[(address & CACHE_ALIAS)>>12]); |
41 | set_pte(pte, entry); | 40 | set_pte(pte, entry); |
42 | local_irq_save(flags); | 41 | local_irq_save(flags); |
43 | __flush_tlb_page(get_asid(), p3_addr); | 42 | flush_tlb_one(get_asid(), p3_addr); |
44 | local_irq_restore(flags); | 43 | local_irq_restore(flags); |
45 | update_mmu_cache(NULL, p3_addr, entry); | 44 | update_mmu_cache(NULL, p3_addr, entry); |
46 | __clear_user_page((void *)p3_addr, to); | 45 | __clear_user_page((void *)p3_addr, to); |
@@ -59,7 +58,6 @@ void clear_user_page(void *to, unsigned long address, struct page *page) | |||
59 | void copy_user_page(void *to, void *from, unsigned long address, | 58 | void copy_user_page(void *to, void *from, unsigned long address, |
60 | struct page *page) | 59 | struct page *page) |
61 | { | 60 | { |
62 | __set_bit(PG_mapped, &page->flags); | ||
63 | if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) | 61 | if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) |
64 | copy_page(to, from); | 62 | copy_page(to, from); |
65 | else { | 63 | else { |
@@ -76,7 +74,7 @@ void copy_user_page(void *to, void *from, unsigned long address, | |||
76 | mutex_lock(&p3map_mutex[(address & CACHE_ALIAS)>>12]); | 74 | mutex_lock(&p3map_mutex[(address & CACHE_ALIAS)>>12]); |
77 | set_pte(pte, entry); | 75 | set_pte(pte, entry); |
78 | local_irq_save(flags); | 76 | local_irq_save(flags); |
79 | __flush_tlb_page(get_asid(), p3_addr); | 77 | flush_tlb_one(get_asid(), p3_addr); |
80 | local_irq_restore(flags); | 78 | local_irq_restore(flags); |
81 | update_mmu_cache(NULL, p3_addr, entry); | 79 | update_mmu_cache(NULL, p3_addr, entry); |
82 | __copy_user_page((void *)p3_addr, from, to); | 80 | __copy_user_page((void *)p3_addr, from, to); |
@@ -84,23 +82,3 @@ void copy_user_page(void *to, void *from, unsigned long address, | |||
84 | mutex_unlock(&p3map_mutex[(address & CACHE_ALIAS)>>12]); | 82 | mutex_unlock(&p3map_mutex[(address & CACHE_ALIAS)>>12]); |
85 | } | 83 | } |
86 | } | 84 | } |
87 | |||
88 | /* | ||
89 | * For SH-4, we have our own implementation for ptep_get_and_clear | ||
90 | */ | ||
91 | inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | ||
92 | { | ||
93 | pte_t pte = *ptep; | ||
94 | |||
95 | pte_clear(mm, addr, ptep); | ||
96 | if (!pte_not_present(pte)) { | ||
97 | unsigned long pfn = pte_pfn(pte); | ||
98 | if (pfn_valid(pfn)) { | ||
99 | struct page *page = pfn_to_page(pfn); | ||
100 | struct address_space *mapping = page_mapping(page); | ||
101 | if (!mapping || !mapping_writably_mapped(mapping)) | ||
102 | __clear_bit(PG_mapped, &page->flags); | ||
103 | } | ||
104 | } | ||
105 | return pte; | ||
106 | } | ||