2 * linux/arch/arm/lib/copypage-fa.S
4 * Copyright (C) 2005 Faraday Corp.
5 * Copyright (C) 2008-2009 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
7 * Based on copypage-v4wb.S:
8 * Copyright (C) 1995-1999 Russell King
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
14 #include <linux/init.h>
15 #include <linux/highmem.h>
18 * Faraday optimised copy_user_page
21 fa_copy_user_page(void *kto
, const void *kfrom
)
24 stmfd sp!, {r4, lr} @ 2\n\
26 1: ldmia r1!, {r3, r4, ip, lr} @ 4\n\
27 stmia r0, {r3, r4, ip, lr} @ 4\n\
28 mcr p15, 0, r0, c7, c14, 1 @ 1 clean and invalidate D line\n\
29 add r0, r0, #16 @ 1\n\
30 ldmia r1!, {r3, r4, ip, lr} @ 4\n\
31 stmia r0, {r3, r4, ip, lr} @ 4\n\
32 mcr p15, 0, r0, c7, c14, 1 @ 1 clean and invalidate D line\n\
33 add r0, r0, #16 @ 1\n\
34 subs r2, r2, #1 @ 1\n\
36 mcr p15, 0, r2, c7, c10, 4 @ 1 drain WB\n\
37 ldmfd sp!, {r4, pc} @ 3"
39 : "I" (PAGE_SIZE
/ 32));
42 void fa_copy_user_highpage(struct page
*to
, struct page
*from
,
43 unsigned long vaddr
, struct vm_area_struct
*vma
)
47 kto
= kmap_atomic(to
);
48 kfrom
= kmap_atomic(from
);
49 fa_copy_user_page(kto
, kfrom
);
55 * Faraday optimised clear_user_page
57 * Same story as above.
59 void fa_clear_user_highpage(struct page
*page
, unsigned long vaddr
)
61 void *ptr
, *kaddr
= kmap_atomic(page
);
68 1: stmia %0, {r2, r3, ip, lr} @ 4\n\
69 mcr p15, 0, %0, c7, c14, 1 @ 1 clean and invalidate D line\n\
70 add %0, %0, #16 @ 1\n\
71 stmia %0, {r2, r3, ip, lr} @ 4\n\
72 mcr p15, 0, %0, c7, c14, 1 @ 1 clean and invalidate D line\n\
73 add %0, %0, #16 @ 1\n\
74 subs r1, r1, #1 @ 1\n\
76 mcr p15, 0, r1, c7, c10, 4 @ 1 drain WB"
78 : "0" (kaddr
), "I" (PAGE_SIZE
/ 32)
79 : "r1", "r2", "r3", "ip", "lr");
83 struct cpu_user_fns fa_user_fns __initdata
= {
84 .cpu_clear_user_highpage
= fa_clear_user_highpage
,
85 .cpu_copy_user_highpage
= fa_copy_user_highpage
,