aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2007-11-05 02:18:16 -0500
committerPaul Mundt <lethal@linux-sh.org>2007-11-06 21:14:12 -0500
commitba1789efea81acc6633f427bfeb871fd608965b5 (patch)
treea93f739cc4d36ebf762ce38a8f90b2ffceecb0b9 /arch/sh
parent7747b9a493a197cb4db44c98d25ce6d3d9f586d1 (diff)
sh: Optimized copy_{to,from}_user_page() for SH-4.
This moves copy_{to,from}_user_page() out-of-line on SH-4 and converts for the kmap_coherent() API. Based on the MIPS implementation. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/mm/pg-sh4.c52
1 files changed, 29 insertions, 23 deletions
diff --git a/arch/sh/mm/pg-sh4.c b/arch/sh/mm/pg-sh4.c
index ede6dd1e3701..8c7a9ca79879 100644
--- a/arch/sh/mm/pg-sh4.c
+++ b/arch/sh/mm/pg-sh4.c
@@ -52,33 +52,39 @@ static inline void kunmap_coherent(struct page *page)
52void clear_user_page(void *to, unsigned long address, struct page *page) 52void clear_user_page(void *to, unsigned long address, struct page *page)
53{ 53{
54 __set_bit(PG_mapped, &page->flags); 54 __set_bit(PG_mapped, &page->flags);
55 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) 55
56 clear_page(to); 56 clear_page(to);
57 else { 57 if ((((address & PAGE_MASK) ^ (unsigned long)to) & CACHE_ALIAS))
58 void *vto = kmap_coherent(page, address); 58 __flush_wback_region(to, PAGE_SIZE);
59 __clear_user_page(vto, to);
60 kunmap_coherent(vto);
61 }
62} 59}
63 60
64/* 61void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
65 * copy_user_page 62 unsigned long vaddr, void *dst, const void *src,
66 * @to: P1 address 63 unsigned long len)
67 * @from: P1 address
68 * @address: U0 address to be mapped
69 * @page: page (virt_to_page(to))
70 */
71void copy_user_page(void *to, void *from, unsigned long address,
72 struct page *page)
73{ 64{
65 void *vto;
66
74 __set_bit(PG_mapped, &page->flags); 67 __set_bit(PG_mapped, &page->flags);
75 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) 68
76 copy_page(to, from); 69 vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
77 else { 70 memcpy(vto, src, len);
78 void *vfrom = kmap_coherent(page, address); 71 kunmap_coherent(vto);
79 __copy_user_page(vfrom, from, to); 72
80 kunmap_coherent(vfrom); 73 if (vma->vm_flags & VM_EXEC)
81 } 74 flush_cache_page(vma, vaddr, page_to_pfn(page));
75}
76
77void copy_from_user_page(struct vm_area_struct *vma, struct page *page,
78 unsigned long vaddr, void *dst, const void *src,
79 unsigned long len)
80{
81 void *vfrom;
82
83 __set_bit(PG_mapped, &page->flags);
84
85 vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
86 memcpy(dst, vfrom, len);
87 kunmap_coherent(vfrom);
82} 88}
83 89
84void copy_user_highpage(struct page *to, struct page *from, 90void copy_user_highpage(struct page *to, struct page *from,