2 * linux/arch/arm/mm/copypage-xsc3.S
4 * Copyright (C) 2004 Intel Corp.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * Adapted for 3rd gen XScale core, no more mini-dcache
11 * Author: Matt Gilbert (matthew.m.gilbert@intel.com)
13 #include <linux/init.h>
14 #include <linux/highmem.h>
18 * We don't really want write-allocate cache behaviour for these functions
19 * since that will just eat through 8K of the cache.
23 * XSC3 optimised copy_user_highpage
27 * The source page may have some clean entries in the cache already, but we
28 * can safely ignore them - break_cow() will flush them out of the cache
29 * if we eventually end up using our copied page.
33 xsc3_mc_copy_user_page(void *kto, const void *kfrom)
36 stmfd sp!, {r4, r5, lr} \n\
44 2: ldrd r2, [r1], #8 \n\
47 mcr p15, 0, ip, c7, c6, 1 @ invalidate\n\
57 mcr p15, 0, ip, c7, c6, 1 @ invalidate\n\
68 ldmfd sp!, {r4, r5, pc}"
70 : "I" (PAGE_SIZE / 64 - 1));
73 void xsc3_mc_copy_user_highpage(struct page *to, struct page *from,
74 unsigned long vaddr, struct vm_area_struct *vma)
78 kto = kmap_atomic(to, KM_USER0);
79 kfrom = kmap_atomic(from, KM_USER1);
80 flush_cache_page(vma, vaddr, page_to_pfn(from));
81 xsc3_mc_copy_user_page(kto, kfrom);
82 kunmap_atomic(kfrom, KM_USER1);
83 kunmap_atomic(kto, KM_USER0);
87 * XScale optimised clear_user_page
89 * r1 = virtual user address of ultimate destination page
91 void xsc3_mc_clear_user_highpage(struct page *page, unsigned long vaddr)
93 void *ptr, *kaddr = kmap_atomic(page, KM_USER0);
98 1: mcr p15, 0, %0, c7, c6, 1 @ invalidate line\n\
100 strd r2, [%0], #8 \n\
101 strd r2, [%0], #8 \n\
102 strd r2, [%0], #8 \n\
106 : "0" (kaddr), "I" (PAGE_SIZE / 32)
108 kunmap_atomic(kaddr, KM_USER0);
111 struct cpu_user_fns xsc3_mc_user_fns __initdata = {
112 .cpu_clear_user_highpage = xsc3_mc_clear_user_highpage,
113 .cpu_copy_user_highpage = xsc3_mc_copy_user_highpage,