aboutsummaryrefslogtreecommitdiff
path: root/arch/sh/mm/pg-sh7705.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-07 10:08:33 -0800
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-07 10:08:33 -0800
commitd694c16bc332c7e706f44e3d10bea06228166a6f (patch)
tree72d0ab61ce633002a1c4de2406101e28e101afa3 /arch/sh/mm/pg-sh7705.c
parentd04f41e35343f1d788551fd3f753f51794f4afcf (diff)
parentccd45ad405bcb1504bd923bd0487902374c942c8 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6: sh: Kill off I/O cruft for R7780RP. sh: Revert lazy dcache writeback changes. sh: Enable SM501 support for RTS7751R2D. sh: Use L1_CACHE_BYTES for .data.cacheline_aligned. sysctl: Support vdso_enabled sysctl on SH. sh: Fix kernel thread stack corruption with preempt. doc: Add SH to vdso and earlyprintk in kernel-parameters.txt sh: Fix sigmask trampling in signal delivery. sh: Clear UBC when not in use.
Diffstat (limited to 'arch/sh/mm/pg-sh7705.c')
-rw-r--r--arch/sh/mm/pg-sh7705.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/arch/sh/mm/pg-sh7705.c b/arch/sh/mm/pg-sh7705.c
index 887ab9d18cc..a4b015f95a3 100644
--- a/arch/sh/mm/pg-sh7705.c
+++ b/arch/sh/mm/pg-sh7705.c
@@ -7,7 +7,9 @@
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
+ *
*/
+
#include <linux/init.h>
#include <linux/mman.h>
#include <linux/mm.h>
@@ -74,6 +76,7 @@ void clear_user_page(void *to, unsigned long address, struct page *pg)
{
struct page *page = virt_to_page(to);
+ __set_bit(PG_mapped, &page->flags);
if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) {
clear_page(to);
__flush_wback_region(to, PAGE_SIZE);
@@ -92,11 +95,12 @@ void clear_user_page(void *to, unsigned long address, struct page *pg)
* @from: P1 address
* @address: U0 address to be mapped
*/
-void copy_user_page(void *to, void *from, unsigned long address,
- struct page *pg)
+void copy_user_page(void *to, void *from, unsigned long address, struct page *pg)
{
struct page *page = virt_to_page(to);
+
+ __set_bit(PG_mapped, &page->flags);
if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) {
copy_page(to, from);
__flush_wback_region(to, PAGE_SIZE);
@@ -108,3 +112,26 @@ void copy_user_page(void *to, void *from, unsigned long address,
__flush_wback_region(to, PAGE_SIZE);
}
}
+
+/*
+ * For SH7705, we have our own implementation for ptep_get_and_clear
+ * Copied from pg-sh4.c
+ */
+inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
+{
+ pte_t pte = *ptep;
+
+ pte_clear(mm, addr, ptep);
+ if (!pte_not_present(pte)) {
+ unsigned long pfn = pte_pfn(pte);
+ if (pfn_valid(pfn)) {
+ struct page *page = pfn_to_page(pfn);
+ struct address_space *mapping = page_mapping(page);
+ if (!mapping || !mapping_writably_mapped(mapping))
+ __clear_bit(PG_mapped, &page->flags);
+ }
+ }
+
+ return pte;
+}
+