2 * linux/arch/arm/mm/copypage-feroceon.S
4 * Copyright (C) 2008 Marvell Semiconductors
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 * This handles copy_user_highpage and clear_user_page on Feroceon
11 * more optimally than the generic implementations.
13 #include <linux/init.h>
14 #include <linux/highmem.h>
17 feroceon_copy_user_page(void *kto
, const void *kfrom
)
20 stmfd sp!, {r4-r9, lr} \n\
23 ldmia r1!, {r2 - r9} \n\
31 stmia r0, {r2 - r9} \n\
32 ldmia r1!, {r2 - r9} \n\
33 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line\n\
35 stmia r0, {r2 - r9} \n\
36 ldmia r1!, {r2 - r9} \n\
37 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line\n\
39 stmia r0, {r2 - r9} \n\
40 ldmia r1!, {r2 - r9} \n\
41 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line\n\
43 stmia r0, {r2 - r9} \n\
44 ldmia r1!, {r2 - r9} \n\
45 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line\n\
47 stmia r0, {r2 - r9} \n\
48 ldmia r1!, {r2 - r9} \n\
49 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line\n\
51 stmia r0, {r2 - r9} \n\
52 ldmia r1!, {r2 - r9} \n\
53 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line\n\
55 stmia r0, {r2 - r9} \n\
56 ldmia r1!, {r2 - r9} \n\
57 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line\n\
59 stmia r0, {r2 - r9} \n\
60 subs ip, ip, #(32 * 8) \n\
61 mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D line\n\
64 mcr p15, 0, ip, c7, c10, 4 @ drain WB\n\
65 ldmfd sp!, {r4-r9, pc}"
67 : "r" (kto
), "r" (kfrom
), "I" (PAGE_SIZE
));
70 void feroceon_copy_user_highpage(struct page
*to
, struct page
*from
,
71 unsigned long vaddr
, struct vm_area_struct
*vma
)
75 kto
= kmap_atomic(to
);
76 kfrom
= kmap_atomic(from
);
77 flush_cache_page(vma
, vaddr
, page_to_pfn(from
));
78 feroceon_copy_user_page(kto
, kfrom
);
83 void feroceon_clear_user_highpage(struct page
*page
, unsigned long vaddr
)
85 void *ptr
, *kaddr
= kmap_atomic(page
);
96 1: stmia %0, {r2-r7, ip, lr} \n\
98 mcr p15, 0, %0, c7, c14, 1 @ clean and invalidate D line\n\
101 mcr p15, 0, r1, c7, c10, 4 @ drain WB"
103 : "0" (kaddr
), "I" (PAGE_SIZE
/ 32)
104 : "r1", "r2", "r3", "r4", "r5", "r6", "r7", "ip", "lr");
105 kunmap_atomic(kaddr
);
108 struct cpu_user_fns feroceon_user_fns __initdata
= {
109 .cpu_clear_user_highpage
= feroceon_clear_user_highpage
,
110 .cpu_copy_user_highpage
= feroceon_copy_user_highpage
,