aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/mm/pg-sh4.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/mm/pg-sh4.c')
-rw-r--r--arch/sh/mm/pg-sh4.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/arch/sh/mm/pg-sh4.c b/arch/sh/mm/pg-sh4.c
index c776b60fc250..07371ed7a313 100644
--- a/arch/sh/mm/pg-sh4.c
+++ b/arch/sh/mm/pg-sh4.c
@@ -2,7 +2,7 @@
2 * arch/sh/mm/pg-sh4.c 2 * arch/sh/mm/pg-sh4.c
3 * 3 *
4 * Copyright (C) 1999, 2000, 2002 Niibe Yutaka 4 * Copyright (C) 1999, 2000, 2002 Niibe Yutaka
5 * Copyright (C) 2002 Paul Mundt 5 * Copyright (C) 2002 - 2005 Paul Mundt
6 * 6 *
7 * Released under the terms of the GNU GPL v2.0. 7 * Released under the terms of the GNU GPL v2.0.
8 */ 8 */
@@ -23,6 +23,8 @@
23 23
24extern struct semaphore p3map_sem[]; 24extern struct semaphore p3map_sem[];
25 25
26#define CACHE_ALIAS (cpu_data->dcache.alias_mask)
27
26/* 28/*
27 * clear_user_page 29 * clear_user_page
28 * @to: P1 address 30 * @to: P1 address
@@ -35,14 +37,15 @@ void clear_user_page(void *to, unsigned long address, struct page *page)
35 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) 37 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0)
36 clear_page(to); 38 clear_page(to);
37 else { 39 else {
38 pgprot_t pgprot = __pgprot(_PAGE_PRESENT | 40 pgprot_t pgprot = __pgprot(_PAGE_PRESENT |
39 _PAGE_RW | _PAGE_CACHABLE | 41 _PAGE_RW | _PAGE_CACHABLE |
40 _PAGE_DIRTY | _PAGE_ACCESSED | 42 _PAGE_DIRTY | _PAGE_ACCESSED |
41 _PAGE_HW_SHARED | _PAGE_FLAGS_HARD); 43 _PAGE_HW_SHARED | _PAGE_FLAGS_HARD);
42 unsigned long phys_addr = PHYSADDR(to); 44 unsigned long phys_addr = PHYSADDR(to);
43 unsigned long p3_addr = P3SEG + (address & CACHE_ALIAS); 45 unsigned long p3_addr = P3SEG + (address & CACHE_ALIAS);
44 pgd_t *dir = pgd_offset_k(p3_addr); 46 pgd_t *pgd = pgd_offset_k(p3_addr);
45 pmd_t *pmd = pmd_offset(dir, p3_addr); 47 pud_t *pud = pud_offset(pgd, p3_addr);
48 pmd_t *pmd = pmd_offset(pud, p3_addr);
46 pte_t *pte = pte_offset_kernel(pmd, p3_addr); 49 pte_t *pte = pte_offset_kernel(pmd, p3_addr);
47 pte_t entry; 50 pte_t entry;
48 unsigned long flags; 51 unsigned long flags;
@@ -67,21 +70,22 @@ void clear_user_page(void *to, unsigned long address, struct page *page)
67 * @address: U0 address to be mapped 70 * @address: U0 address to be mapped
68 * @page: page (virt_to_page(to)) 71 * @page: page (virt_to_page(to))
69 */ 72 */
70void copy_user_page(void *to, void *from, unsigned long address, 73void copy_user_page(void *to, void *from, unsigned long address,
71 struct page *page) 74 struct page *page)
72{ 75{
73 __set_bit(PG_mapped, &page->flags); 76 __set_bit(PG_mapped, &page->flags);
74 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) 77 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0)
75 copy_page(to, from); 78 copy_page(to, from);
76 else { 79 else {
77 pgprot_t pgprot = __pgprot(_PAGE_PRESENT | 80 pgprot_t pgprot = __pgprot(_PAGE_PRESENT |
78 _PAGE_RW | _PAGE_CACHABLE | 81 _PAGE_RW | _PAGE_CACHABLE |
79 _PAGE_DIRTY | _PAGE_ACCESSED | 82 _PAGE_DIRTY | _PAGE_ACCESSED |
80 _PAGE_HW_SHARED | _PAGE_FLAGS_HARD); 83 _PAGE_HW_SHARED | _PAGE_FLAGS_HARD);
81 unsigned long phys_addr = PHYSADDR(to); 84 unsigned long phys_addr = PHYSADDR(to);
82 unsigned long p3_addr = P3SEG + (address & CACHE_ALIAS); 85 unsigned long p3_addr = P3SEG + (address & CACHE_ALIAS);
83 pgd_t *dir = pgd_offset_k(p3_addr); 86 pgd_t *pgd = pgd_offset_k(p3_addr);
84 pmd_t *pmd = pmd_offset(dir, p3_addr); 87 pud_t *pud = pud_offset(pgd, p3_addr);
88 pmd_t *pmd = pmd_offset(pud, p3_addr);
85 pte_t *pte = pte_offset_kernel(pmd, p3_addr); 89 pte_t *pte = pte_offset_kernel(pmd, p3_addr);
86 pte_t entry; 90 pte_t entry;
87 unsigned long flags; 91 unsigned long flags;