diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-08-18 19:20:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-08-18 19:20:05 -0400 |
commit | 6dab7ede9390d4d937cb89feca932e4fd575d2da (patch) | |
tree | bd5a12dd472c5cf7cdaf13ea4fcceae831e26e46 /arch/arm | |
parent | d9ec0fdc24743cb6aa9b7dee9064455cd26782f9 (diff) | |
parent | 89868730a756feca7e4b21a97c86487cd565ed22 (diff) |
Merge branch 'fixes' of git://git.linaro.org/people/rmk/linux-arm
Pull ARM fixes from Russell King:
"The largest thing in this set of changes is bringing back some of the
ARMv3 code to fix a compile problem noticed on RiscPC, which we still
support, even though we only support ARMv4 there.
(The reason is that the system bus doesn't support ARMv4 half-word
accesses, so we need the ARMv3 library code for this platform.)
The rest are all quite minor fixes."
* 'fixes' of git://git.linaro.org/people/rmk/linux-arm:
ARM: 7490/1: Drop duplicate select for GENERIC_IRQ_PROBE
ARM: Bring back ARMv3 IO and user access code
ARM: 7489/1: errata: fix workaround for erratum #720789 on UP systems
ARM: 7488/1: mm: use 5 bits for swapfile type encoding
ARM: 7487/1: mm: avoid setting nG bit for user mappings that aren't present
ARM: 7486/1: sched_clock: update epoch_cyc on resume
ARM: 7484/1: Don't enable GENERIC_LOCKBREAK with ticket spinlocks
ARM: 7483/1: vfp: only advertise VFPv4 in hwcaps if CONFIG_VFPv3 is enabled
ARM: 7482/1: topology: fix section mismatch warning for init_cpu_topology
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/Kconfig | 6 | ||||
-rw-r--r-- | arch/arm/include/asm/pgtable.h | 40 | ||||
-rw-r--r-- | arch/arm/include/asm/sched_clock.h | 2 | ||||
-rw-r--r-- | arch/arm/kernel/sched_clock.c | 24 | ||||
-rw-r--r-- | arch/arm/kernel/topology.c | 2 | ||||
-rw-r--r-- | arch/arm/lib/Makefile | 23 | ||||
-rw-r--r-- | arch/arm/lib/io-readsw-armv3.S | 106 | ||||
-rw-r--r-- | arch/arm/lib/io-writesw-armv3.S | 126 | ||||
-rw-r--r-- | arch/arm/lib/uaccess.S | 564 | ||||
-rw-r--r-- | arch/arm/mm/flush.c | 2 | ||||
-rw-r--r-- | arch/arm/mm/tlb-v7.S | 6 | ||||
-rw-r--r-- | arch/arm/vfp/vfpmodule.c | 2 |
12 files changed, 869 insertions, 34 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index e91c7cdc6fe5..6d6e18fee9fe 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -38,7 +38,6 @@ config ARM | |||
38 | select HARDIRQS_SW_RESEND | 38 | select HARDIRQS_SW_RESEND |
39 | select GENERIC_IRQ_PROBE | 39 | select GENERIC_IRQ_PROBE |
40 | select GENERIC_IRQ_SHOW | 40 | select GENERIC_IRQ_SHOW |
41 | select GENERIC_IRQ_PROBE | ||
42 | select ARCH_WANT_IPC_PARSE_VERSION | 41 | select ARCH_WANT_IPC_PARSE_VERSION |
43 | select HARDIRQS_SW_RESEND | 42 | select HARDIRQS_SW_RESEND |
44 | select CPU_PM if (SUSPEND || CPU_IDLE) | 43 | select CPU_PM if (SUSPEND || CPU_IDLE) |
@@ -126,11 +125,6 @@ config TRACE_IRQFLAGS_SUPPORT | |||
126 | bool | 125 | bool |
127 | default y | 126 | default y |
128 | 127 | ||
129 | config GENERIC_LOCKBREAK | ||
130 | bool | ||
131 | default y | ||
132 | depends on SMP && PREEMPT | ||
133 | |||
134 | config RWSEM_GENERIC_SPINLOCK | 128 | config RWSEM_GENERIC_SPINLOCK |
135 | bool | 129 | bool |
136 | default y | 130 | default y |
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h index f66626d71e7d..41dc31f834c3 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h | |||
@@ -195,6 +195,18 @@ static inline pte_t *pmd_page_vaddr(pmd_t pmd) | |||
195 | 195 | ||
196 | #define pte_clear(mm,addr,ptep) set_pte_ext(ptep, __pte(0), 0) | 196 | #define pte_clear(mm,addr,ptep) set_pte_ext(ptep, __pte(0), 0) |
197 | 197 | ||
198 | #define pte_none(pte) (!pte_val(pte)) | ||
199 | #define pte_present(pte) (pte_val(pte) & L_PTE_PRESENT) | ||
200 | #define pte_write(pte) (!(pte_val(pte) & L_PTE_RDONLY)) | ||
201 | #define pte_dirty(pte) (pte_val(pte) & L_PTE_DIRTY) | ||
202 | #define pte_young(pte) (pte_val(pte) & L_PTE_YOUNG) | ||
203 | #define pte_exec(pte) (!(pte_val(pte) & L_PTE_XN)) | ||
204 | #define pte_special(pte) (0) | ||
205 | |||
206 | #define pte_present_user(pte) \ | ||
207 | ((pte_val(pte) & (L_PTE_PRESENT | L_PTE_USER)) == \ | ||
208 | (L_PTE_PRESENT | L_PTE_USER)) | ||
209 | |||
198 | #if __LINUX_ARM_ARCH__ < 6 | 210 | #if __LINUX_ARM_ARCH__ < 6 |
199 | static inline void __sync_icache_dcache(pte_t pteval) | 211 | static inline void __sync_icache_dcache(pte_t pteval) |
200 | { | 212 | { |
@@ -206,25 +218,15 @@ extern void __sync_icache_dcache(pte_t pteval); | |||
206 | static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, | 218 | static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, |
207 | pte_t *ptep, pte_t pteval) | 219 | pte_t *ptep, pte_t pteval) |
208 | { | 220 | { |
209 | if (addr >= TASK_SIZE) | 221 | unsigned long ext = 0; |
210 | set_pte_ext(ptep, pteval, 0); | 222 | |
211 | else { | 223 | if (addr < TASK_SIZE && pte_present_user(pteval)) { |
212 | __sync_icache_dcache(pteval); | 224 | __sync_icache_dcache(pteval); |
213 | set_pte_ext(ptep, pteval, PTE_EXT_NG); | 225 | ext |= PTE_EXT_NG; |
214 | } | 226 | } |
215 | } | ||
216 | 227 | ||
217 | #define pte_none(pte) (!pte_val(pte)) | 228 | set_pte_ext(ptep, pteval, ext); |
218 | #define pte_present(pte) (pte_val(pte) & L_PTE_PRESENT) | 229 | } |
219 | #define pte_write(pte) (!(pte_val(pte) & L_PTE_RDONLY)) | ||
220 | #define pte_dirty(pte) (pte_val(pte) & L_PTE_DIRTY) | ||
221 | #define pte_young(pte) (pte_val(pte) & L_PTE_YOUNG) | ||
222 | #define pte_exec(pte) (!(pte_val(pte) & L_PTE_XN)) | ||
223 | #define pte_special(pte) (0) | ||
224 | |||
225 | #define pte_present_user(pte) \ | ||
226 | ((pte_val(pte) & (L_PTE_PRESENT | L_PTE_USER)) == \ | ||
227 | (L_PTE_PRESENT | L_PTE_USER)) | ||
228 | 230 | ||
229 | #define PTE_BIT_FUNC(fn,op) \ | 231 | #define PTE_BIT_FUNC(fn,op) \ |
230 | static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; } | 232 | static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; } |
@@ -251,13 +253,13 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
251 | * | 253 | * |
252 | * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 | 254 | * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 |
253 | * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 | 255 | * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 |
254 | * <--------------- offset --------------------> <- type --> 0 0 0 | 256 | * <--------------- offset ----------------------> < type -> 0 0 0 |
255 | * | 257 | * |
256 | * This gives us up to 63 swap files and 32GB per swap file. Note that | 258 | * This gives us up to 31 swap files and 64GB per swap file. Note that |
257 | * the offset field is always non-zero. | 259 | * the offset field is always non-zero. |
258 | */ | 260 | */ |
259 | #define __SWP_TYPE_SHIFT 3 | 261 | #define __SWP_TYPE_SHIFT 3 |
260 | #define __SWP_TYPE_BITS 6 | 262 | #define __SWP_TYPE_BITS 5 |
261 | #define __SWP_TYPE_MASK ((1 << __SWP_TYPE_BITS) - 1) | 263 | #define __SWP_TYPE_MASK ((1 << __SWP_TYPE_BITS) - 1) |
262 | #define __SWP_OFFSET_SHIFT (__SWP_TYPE_BITS + __SWP_TYPE_SHIFT) | 264 | #define __SWP_OFFSET_SHIFT (__SWP_TYPE_BITS + __SWP_TYPE_SHIFT) |
263 | 265 | ||
diff --git a/arch/arm/include/asm/sched_clock.h b/arch/arm/include/asm/sched_clock.h index e3f757263438..05b8e82ec9f5 100644 --- a/arch/arm/include/asm/sched_clock.h +++ b/arch/arm/include/asm/sched_clock.h | |||
@@ -10,5 +10,7 @@ | |||
10 | 10 | ||
11 | extern void sched_clock_postinit(void); | 11 | extern void sched_clock_postinit(void); |
12 | extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate); | 12 | extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate); |
13 | extern void setup_sched_clock_needs_suspend(u32 (*read)(void), int bits, | ||
14 | unsigned long rate); | ||
13 | 15 | ||
14 | #endif | 16 | #endif |
diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c index 27d186abbc06..f4515393248d 100644 --- a/arch/arm/kernel/sched_clock.c +++ b/arch/arm/kernel/sched_clock.c | |||
@@ -21,6 +21,8 @@ struct clock_data { | |||
21 | u32 epoch_cyc_copy; | 21 | u32 epoch_cyc_copy; |
22 | u32 mult; | 22 | u32 mult; |
23 | u32 shift; | 23 | u32 shift; |
24 | bool suspended; | ||
25 | bool needs_suspend; | ||
24 | }; | 26 | }; |
25 | 27 | ||
26 | static void sched_clock_poll(unsigned long wrap_ticks); | 28 | static void sched_clock_poll(unsigned long wrap_ticks); |
@@ -49,6 +51,9 @@ static unsigned long long cyc_to_sched_clock(u32 cyc, u32 mask) | |||
49 | u64 epoch_ns; | 51 | u64 epoch_ns; |
50 | u32 epoch_cyc; | 52 | u32 epoch_cyc; |
51 | 53 | ||
54 | if (cd.suspended) | ||
55 | return cd.epoch_ns; | ||
56 | |||
52 | /* | 57 | /* |
53 | * Load the epoch_cyc and epoch_ns atomically. We do this by | 58 | * Load the epoch_cyc and epoch_ns atomically. We do this by |
54 | * ensuring that we always write epoch_cyc, epoch_ns and | 59 | * ensuring that we always write epoch_cyc, epoch_ns and |
@@ -98,6 +103,13 @@ static void sched_clock_poll(unsigned long wrap_ticks) | |||
98 | update_sched_clock(); | 103 | update_sched_clock(); |
99 | } | 104 | } |
100 | 105 | ||
106 | void __init setup_sched_clock_needs_suspend(u32 (*read)(void), int bits, | ||
107 | unsigned long rate) | ||
108 | { | ||
109 | setup_sched_clock(read, bits, rate); | ||
110 | cd.needs_suspend = true; | ||
111 | } | ||
112 | |||
101 | void __init setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate) | 113 | void __init setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate) |
102 | { | 114 | { |
103 | unsigned long r, w; | 115 | unsigned long r, w; |
@@ -169,11 +181,23 @@ void __init sched_clock_postinit(void) | |||
169 | static int sched_clock_suspend(void) | 181 | static int sched_clock_suspend(void) |
170 | { | 182 | { |
171 | sched_clock_poll(sched_clock_timer.data); | 183 | sched_clock_poll(sched_clock_timer.data); |
184 | if (cd.needs_suspend) | ||
185 | cd.suspended = true; | ||
172 | return 0; | 186 | return 0; |
173 | } | 187 | } |
174 | 188 | ||
189 | static void sched_clock_resume(void) | ||
190 | { | ||
191 | if (cd.needs_suspend) { | ||
192 | cd.epoch_cyc = read_sched_clock(); | ||
193 | cd.epoch_cyc_copy = cd.epoch_cyc; | ||
194 | cd.suspended = false; | ||
195 | } | ||
196 | } | ||
197 | |||
175 | static struct syscore_ops sched_clock_ops = { | 198 | static struct syscore_ops sched_clock_ops = { |
176 | .suspend = sched_clock_suspend, | 199 | .suspend = sched_clock_suspend, |
200 | .resume = sched_clock_resume, | ||
177 | }; | 201 | }; |
178 | 202 | ||
179 | static int __init sched_clock_syscore_init(void) | 203 | static int __init sched_clock_syscore_init(void) |
diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c index 198b08456e90..26c12c6440fc 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c | |||
@@ -321,7 +321,7 @@ void store_cpu_topology(unsigned int cpuid) | |||
321 | * init_cpu_topology is called at boot when only one cpu is running | 321 | * init_cpu_topology is called at boot when only one cpu is running |
322 | * which prevent simultaneous write access to cpu_topology array | 322 | * which prevent simultaneous write access to cpu_topology array |
323 | */ | 323 | */ |
324 | void init_cpu_topology(void) | 324 | void __init init_cpu_topology(void) |
325 | { | 325 | { |
326 | unsigned int cpu; | 326 | unsigned int cpu; |
327 | 327 | ||
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index 2473fd1fd51c..af72969820b4 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile | |||
@@ -16,13 +16,30 @@ lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ | |||
16 | call_with_stack.o | 16 | call_with_stack.o |
17 | 17 | ||
18 | mmu-y := clear_user.o copy_page.o getuser.o putuser.o | 18 | mmu-y := clear_user.o copy_page.o getuser.o putuser.o |
19 | mmu-y += copy_from_user.o copy_to_user.o | 19 | |
20 | # the code in uaccess.S is not preemption safe and | ||
21 | # probably faster on ARMv3 only | ||
22 | ifeq ($(CONFIG_PREEMPT),y) | ||
23 | mmu-y += copy_from_user.o copy_to_user.o | ||
24 | else | ||
25 | ifneq ($(CONFIG_CPU_32v3),y) | ||
26 | mmu-y += copy_from_user.o copy_to_user.o | ||
27 | else | ||
28 | mmu-y += uaccess.o | ||
29 | endif | ||
30 | endif | ||
20 | 31 | ||
21 | # using lib_ here won't override already available weak symbols | 32 | # using lib_ here won't override already available weak symbols |
22 | obj-$(CONFIG_UACCESS_WITH_MEMCPY) += uaccess_with_memcpy.o | 33 | obj-$(CONFIG_UACCESS_WITH_MEMCPY) += uaccess_with_memcpy.o |
23 | 34 | ||
24 | lib-$(CONFIG_MMU) += $(mmu-y) | 35 | lib-$(CONFIG_MMU) += $(mmu-y) |
25 | lib-y += io-readsw-armv4.o io-writesw-armv4.o | 36 | |
37 | ifeq ($(CONFIG_CPU_32v3),y) | ||
38 | lib-y += io-readsw-armv3.o io-writesw-armv3.o | ||
39 | else | ||
40 | lib-y += io-readsw-armv4.o io-writesw-armv4.o | ||
41 | endif | ||
42 | |||
26 | lib-$(CONFIG_ARCH_RPC) += ecard.o io-acorn.o floppydma.o | 43 | lib-$(CONFIG_ARCH_RPC) += ecard.o io-acorn.o floppydma.o |
27 | lib-$(CONFIG_ARCH_SHARK) += io-shark.o | 44 | lib-$(CONFIG_ARCH_SHARK) += io-shark.o |
28 | 45 | ||
diff --git a/arch/arm/lib/io-readsw-armv3.S b/arch/arm/lib/io-readsw-armv3.S new file mode 100644 index 000000000000..88487c8c4f23 --- /dev/null +++ b/arch/arm/lib/io-readsw-armv3.S | |||
@@ -0,0 +1,106 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/lib/io-readsw-armv3.S | ||
3 | * | ||
4 | * Copyright (C) 1995-2000 Russell King | ||
5 | * | ||
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. | ||
9 | */ | ||
10 | #include <linux/linkage.h> | ||
11 | #include <asm/assembler.h> | ||
12 | |||
13 | .Linsw_bad_alignment: | ||
14 | adr r0, .Linsw_bad_align_msg | ||
15 | mov r2, lr | ||
16 | b panic | ||
17 | .Linsw_bad_align_msg: | ||
18 | .asciz "insw: bad buffer alignment (0x%p, lr=0x%08lX)\n" | ||
19 | .align | ||
20 | |||
21 | .Linsw_align: tst r1, #1 | ||
22 | bne .Linsw_bad_alignment | ||
23 | |||
24 | ldr r3, [r0] | ||
25 | strb r3, [r1], #1 | ||
26 | mov r3, r3, lsr #8 | ||
27 | strb r3, [r1], #1 | ||
28 | |||
29 | subs r2, r2, #1 | ||
30 | moveq pc, lr | ||
31 | |||
32 | ENTRY(__raw_readsw) | ||
33 | teq r2, #0 @ do we have to check for the zero len? | ||
34 | moveq pc, lr | ||
35 | tst r1, #3 | ||
36 | bne .Linsw_align | ||
37 | |||
38 | .Linsw_aligned: mov ip, #0xff | ||
39 | orr ip, ip, ip, lsl #8 | ||
40 | stmfd sp!, {r4, r5, r6, lr} | ||
41 | |||
42 | subs r2, r2, #8 | ||
43 | bmi .Lno_insw_8 | ||
44 | |||
45 | .Linsw_8_lp: ldr r3, [r0] | ||
46 | and r3, r3, ip | ||
47 | ldr r4, [r0] | ||
48 | orr r3, r3, r4, lsl #16 | ||
49 | |||
50 | ldr r4, [r0] | ||
51 | and r4, r4, ip | ||
52 | ldr r5, [r0] | ||
53 | orr r4, r4, r5, lsl #16 | ||
54 | |||
55 | ldr r5, [r0] | ||
56 | and r5, r5, ip | ||
57 | ldr r6, [r0] | ||
58 | orr r5, r5, r6, lsl #16 | ||
59 | |||
60 | ldr r6, [r0] | ||
61 | and r6, r6, ip | ||
62 | ldr lr, [r0] | ||
63 | orr r6, r6, lr, lsl #16 | ||
64 | |||
65 | stmia r1!, {r3 - r6} | ||
66 | |||
67 | subs r2, r2, #8 | ||
68 | bpl .Linsw_8_lp | ||
69 | |||
70 | tst r2, #7 | ||
71 | ldmeqfd sp!, {r4, r5, r6, pc} | ||
72 | |||
73 | .Lno_insw_8: tst r2, #4 | ||
74 | beq .Lno_insw_4 | ||
75 | |||
76 | ldr r3, [r0] | ||
77 | and r3, r3, ip | ||
78 | ldr r4, [r0] | ||
79 | orr r3, r3, r4, lsl #16 | ||
80 | |||
81 | ldr r4, [r0] | ||
82 | and r4, r4, ip | ||
83 | ldr r5, [r0] | ||
84 | orr r4, r4, r5, lsl #16 | ||
85 | |||
86 | stmia r1!, {r3, r4} | ||
87 | |||
88 | .Lno_insw_4: tst r2, #2 | ||
89 | beq .Lno_insw_2 | ||
90 | |||
91 | ldr r3, [r0] | ||
92 | and r3, r3, ip | ||
93 | ldr r4, [r0] | ||
94 | orr r3, r3, r4, lsl #16 | ||
95 | |||
96 | str r3, [r1], #4 | ||
97 | |||
98 | .Lno_insw_2: tst r2, #1 | ||
99 | ldrne r3, [r0] | ||
100 | strneb r3, [r1], #1 | ||
101 | movne r3, r3, lsr #8 | ||
102 | strneb r3, [r1] | ||
103 | |||
104 | ldmfd sp!, {r4, r5, r6, pc} | ||
105 | |||
106 | |||
diff --git a/arch/arm/lib/io-writesw-armv3.S b/arch/arm/lib/io-writesw-armv3.S new file mode 100644 index 000000000000..49b800419e32 --- /dev/null +++ b/arch/arm/lib/io-writesw-armv3.S | |||
@@ -0,0 +1,126 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/lib/io-writesw-armv3.S | ||
3 | * | ||
4 | * Copyright (C) 1995-2000 Russell King | ||
5 | * | ||
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. | ||
9 | */ | ||
10 | #include <linux/linkage.h> | ||
11 | #include <asm/assembler.h> | ||
12 | |||
13 | .Loutsw_bad_alignment: | ||
14 | adr r0, .Loutsw_bad_align_msg | ||
15 | mov r2, lr | ||
16 | b panic | ||
17 | .Loutsw_bad_align_msg: | ||
18 | .asciz "outsw: bad buffer alignment (0x%p, lr=0x%08lX)\n" | ||
19 | .align | ||
20 | |||
21 | .Loutsw_align: tst r1, #1 | ||
22 | bne .Loutsw_bad_alignment | ||
23 | |||
24 | add r1, r1, #2 | ||
25 | |||
26 | ldr r3, [r1, #-4] | ||
27 | mov r3, r3, lsr #16 | ||
28 | orr r3, r3, r3, lsl #16 | ||
29 | str r3, [r0] | ||
30 | subs r2, r2, #1 | ||
31 | moveq pc, lr | ||
32 | |||
33 | ENTRY(__raw_writesw) | ||
34 | teq r2, #0 @ do we have to check for the zero len? | ||
35 | moveq pc, lr | ||
36 | tst r1, #3 | ||
37 | bne .Loutsw_align | ||
38 | |||
39 | stmfd sp!, {r4, r5, r6, lr} | ||
40 | |||
41 | subs r2, r2, #8 | ||
42 | bmi .Lno_outsw_8 | ||
43 | |||
44 | .Loutsw_8_lp: ldmia r1!, {r3, r4, r5, r6} | ||
45 | |||
46 | mov ip, r3, lsl #16 | ||
47 | orr ip, ip, ip, lsr #16 | ||
48 | str ip, [r0] | ||
49 | |||
50 | mov ip, r3, lsr #16 | ||
51 | orr ip, ip, ip, lsl #16 | ||
52 | str ip, [r0] | ||
53 | |||
54 | mov ip, r4, lsl #16 | ||
55 | orr ip, ip, ip, lsr #16 | ||
56 | str ip, [r0] | ||
57 | |||
58 | mov ip, r4, lsr #16 | ||
59 | orr ip, ip, ip, lsl #16 | ||
60 | str ip, [r0] | ||
61 | |||
62 | mov ip, r5, lsl #16 | ||
63 | orr ip, ip, ip, lsr #16 | ||
64 | str ip, [r0] | ||
65 | |||
66 | mov ip, r5, lsr #16 | ||
67 | orr ip, ip, ip, lsl #16 | ||
68 | str ip, [r0] | ||
69 | |||
70 | mov ip, r6, lsl #16 | ||
71 | orr ip, ip, ip, lsr #16 | ||
72 | str ip, [r0] | ||
73 | |||
74 | mov ip, r6, lsr #16 | ||
75 | orr ip, ip, ip, lsl #16 | ||
76 | str ip, [r0] | ||
77 | |||
78 | subs r2, r2, #8 | ||
79 | bpl .Loutsw_8_lp | ||
80 | |||
81 | tst r2, #7 | ||
82 | ldmeqfd sp!, {r4, r5, r6, pc} | ||
83 | |||
84 | .Lno_outsw_8: tst r2, #4 | ||
85 | beq .Lno_outsw_4 | ||
86 | |||
87 | ldmia r1!, {r3, r4} | ||
88 | |||
89 | mov ip, r3, lsl #16 | ||
90 | orr ip, ip, ip, lsr #16 | ||
91 | str ip, [r0] | ||
92 | |||
93 | mov ip, r3, lsr #16 | ||
94 | orr ip, ip, ip, lsl #16 | ||
95 | str ip, [r0] | ||
96 | |||
97 | mov ip, r4, lsl #16 | ||
98 | orr ip, ip, ip, lsr #16 | ||
99 | str ip, [r0] | ||
100 | |||
101 | mov ip, r4, lsr #16 | ||
102 | orr ip, ip, ip, lsl #16 | ||
103 | str ip, [r0] | ||
104 | |||
105 | .Lno_outsw_4: tst r2, #2 | ||
106 | beq .Lno_outsw_2 | ||
107 | |||
108 | ldr r3, [r1], #4 | ||
109 | |||
110 | mov ip, r3, lsl #16 | ||
111 | orr ip, ip, ip, lsr #16 | ||
112 | str ip, [r0] | ||
113 | |||
114 | mov ip, r3, lsr #16 | ||
115 | orr ip, ip, ip, lsl #16 | ||
116 | str ip, [r0] | ||
117 | |||
118 | .Lno_outsw_2: tst r2, #1 | ||
119 | |||
120 | ldrne r3, [r1] | ||
121 | |||
122 | movne ip, r3, lsl #16 | ||
123 | orrne ip, ip, ip, lsr #16 | ||
124 | strne ip, [r0] | ||
125 | |||
126 | ldmfd sp!, {r4, r5, r6, pc} | ||
diff --git a/arch/arm/lib/uaccess.S b/arch/arm/lib/uaccess.S new file mode 100644 index 000000000000..5c908b1cb8ed --- /dev/null +++ b/arch/arm/lib/uaccess.S | |||
@@ -0,0 +1,564 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/lib/uaccess.S | ||
3 | * | ||
4 | * Copyright (C) 1995, 1996,1997,1998 Russell King | ||
5 | * | ||
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. | ||
9 | * | ||
10 | * Routines to block copy data to/from user memory | ||
11 | * These are highly optimised both for the 4k page size | ||
12 | * and for various alignments. | ||
13 | */ | ||
14 | #include <linux/linkage.h> | ||
15 | #include <asm/assembler.h> | ||
16 | #include <asm/errno.h> | ||
17 | #include <asm/domain.h> | ||
18 | |||
19 | .text | ||
20 | |||
21 | #define PAGE_SHIFT 12 | ||
22 | |||
23 | /* Prototype: int __copy_to_user(void *to, const char *from, size_t n) | ||
24 | * Purpose : copy a block to user memory from kernel memory | ||
25 | * Params : to - user memory | ||
26 | * : from - kernel memory | ||
27 | * : n - number of bytes to copy | ||
28 | * Returns : Number of bytes NOT copied. | ||
29 | */ | ||
30 | |||
31 | .Lc2u_dest_not_aligned: | ||
32 | rsb ip, ip, #4 | ||
33 | cmp ip, #2 | ||
34 | ldrb r3, [r1], #1 | ||
35 | USER( TUSER( strb) r3, [r0], #1) @ May fault | ||
36 | ldrgeb r3, [r1], #1 | ||
37 | USER( TUSER( strgeb) r3, [r0], #1) @ May fault | ||
38 | ldrgtb r3, [r1], #1 | ||
39 | USER( TUSER( strgtb) r3, [r0], #1) @ May fault | ||
40 | sub r2, r2, ip | ||
41 | b .Lc2u_dest_aligned | ||
42 | |||
43 | ENTRY(__copy_to_user) | ||
44 | stmfd sp!, {r2, r4 - r7, lr} | ||
45 | cmp r2, #4 | ||
46 | blt .Lc2u_not_enough | ||
47 | ands ip, r0, #3 | ||
48 | bne .Lc2u_dest_not_aligned | ||
49 | .Lc2u_dest_aligned: | ||
50 | |||
51 | ands ip, r1, #3 | ||
52 | bne .Lc2u_src_not_aligned | ||
53 | /* | ||
54 | * Seeing as there has to be at least 8 bytes to copy, we can | ||
55 | * copy one word, and force a user-mode page fault... | ||
56 | */ | ||
57 | |||
58 | .Lc2u_0fupi: subs r2, r2, #4 | ||
59 | addmi ip, r2, #4 | ||
60 | bmi .Lc2u_0nowords | ||
61 | ldr r3, [r1], #4 | ||
62 | USER( TUSER( str) r3, [r0], #4) @ May fault | ||
63 | mov ip, r0, lsl #32 - PAGE_SHIFT @ On each page, use a ld/st??t instruction | ||
64 | rsb ip, ip, #0 | ||
65 | movs ip, ip, lsr #32 - PAGE_SHIFT | ||
66 | beq .Lc2u_0fupi | ||
67 | /* | ||
68 | * ip = max no. of bytes to copy before needing another "strt" insn | ||
69 | */ | ||
70 | cmp r2, ip | ||
71 | movlt ip, r2 | ||
72 | sub r2, r2, ip | ||
73 | subs ip, ip, #32 | ||
74 | blt .Lc2u_0rem8lp | ||
75 | |||
76 | .Lc2u_0cpy8lp: ldmia r1!, {r3 - r6} | ||
77 | stmia r0!, {r3 - r6} @ Shouldnt fault | ||
78 | ldmia r1!, {r3 - r6} | ||
79 | subs ip, ip, #32 | ||
80 | stmia r0!, {r3 - r6} @ Shouldnt fault | ||
81 | bpl .Lc2u_0cpy8lp | ||
82 | |||
83 | .Lc2u_0rem8lp: cmn ip, #16 | ||
84 | ldmgeia r1!, {r3 - r6} | ||
85 | stmgeia r0!, {r3 - r6} @ Shouldnt fault | ||
86 | tst ip, #8 | ||
87 | ldmneia r1!, {r3 - r4} | ||
88 | stmneia r0!, {r3 - r4} @ Shouldnt fault | ||
89 | tst ip, #4 | ||
90 | ldrne r3, [r1], #4 | ||
91 | TUSER( strne) r3, [r0], #4 @ Shouldnt fault | ||
92 | ands ip, ip, #3 | ||
93 | beq .Lc2u_0fupi | ||
94 | .Lc2u_0nowords: teq ip, #0 | ||
95 | beq .Lc2u_finished | ||
96 | .Lc2u_nowords: cmp ip, #2 | ||
97 | ldrb r3, [r1], #1 | ||
98 | USER( TUSER( strb) r3, [r0], #1) @ May fault | ||
99 | ldrgeb r3, [r1], #1 | ||
100 | USER( TUSER( strgeb) r3, [r0], #1) @ May fault | ||
101 | ldrgtb r3, [r1], #1 | ||
102 | USER( TUSER( strgtb) r3, [r0], #1) @ May fault | ||
103 | b .Lc2u_finished | ||
104 | |||
105 | .Lc2u_not_enough: | ||
106 | movs ip, r2 | ||
107 | bne .Lc2u_nowords | ||
108 | .Lc2u_finished: mov r0, #0 | ||
109 | ldmfd sp!, {r2, r4 - r7, pc} | ||
110 | |||
111 | .Lc2u_src_not_aligned: | ||
112 | bic r1, r1, #3 | ||
113 | ldr r7, [r1], #4 | ||
114 | cmp ip, #2 | ||
115 | bgt .Lc2u_3fupi | ||
116 | beq .Lc2u_2fupi | ||
117 | .Lc2u_1fupi: subs r2, r2, #4 | ||
118 | addmi ip, r2, #4 | ||
119 | bmi .Lc2u_1nowords | ||
120 | mov r3, r7, pull #8 | ||
121 | ldr r7, [r1], #4 | ||
122 | orr r3, r3, r7, push #24 | ||
123 | USER( TUSER( str) r3, [r0], #4) @ May fault | ||
124 | mov ip, r0, lsl #32 - PAGE_SHIFT | ||
125 | rsb ip, ip, #0 | ||
126 | movs ip, ip, lsr #32 - PAGE_SHIFT | ||
127 | beq .Lc2u_1fupi | ||
128 | cmp r2, ip | ||
129 | movlt ip, r2 | ||
130 | sub r2, r2, ip | ||
131 | subs ip, ip, #16 | ||
132 | blt .Lc2u_1rem8lp | ||
133 | |||
134 | .Lc2u_1cpy8lp: mov r3, r7, pull #8 | ||
135 | ldmia r1!, {r4 - r7} | ||
136 | subs ip, ip, #16 | ||
137 | orr r3, r3, r4, push #24 | ||
138 | mov r4, r4, pull #8 | ||
139 | orr r4, r4, r5, push #24 | ||
140 | mov r5, r5, pull #8 | ||
141 | orr r5, r5, r6, push #24 | ||
142 | mov r6, r6, pull #8 | ||
143 | orr r6, r6, r7, push #24 | ||
144 | stmia r0!, {r3 - r6} @ Shouldnt fault | ||
145 | bpl .Lc2u_1cpy8lp | ||
146 | |||
147 | .Lc2u_1rem8lp: tst ip, #8 | ||
148 | movne r3, r7, pull #8 | ||
149 | ldmneia r1!, {r4, r7} | ||
150 | orrne r3, r3, r4, push #24 | ||
151 | movne r4, r4, pull #8 | ||
152 | orrne r4, r4, r7, push #24 | ||
153 | stmneia r0!, {r3 - r4} @ Shouldnt fault | ||
154 | tst ip, #4 | ||
155 | movne r3, r7, pull #8 | ||
156 | ldrne r7, [r1], #4 | ||
157 | orrne r3, r3, r7, push #24 | ||
158 | TUSER( strne) r3, [r0], #4 @ Shouldnt fault | ||
159 | ands ip, ip, #3 | ||
160 | beq .Lc2u_1fupi | ||
161 | .Lc2u_1nowords: mov r3, r7, get_byte_1 | ||
162 | teq ip, #0 | ||
163 | beq .Lc2u_finished | ||
164 | cmp ip, #2 | ||
165 | USER( TUSER( strb) r3, [r0], #1) @ May fault | ||
166 | movge r3, r7, get_byte_2 | ||
167 | USER( TUSER( strgeb) r3, [r0], #1) @ May fault | ||
168 | movgt r3, r7, get_byte_3 | ||
169 | USER( TUSER( strgtb) r3, [r0], #1) @ May fault | ||
170 | b .Lc2u_finished | ||
171 | |||
172 | .Lc2u_2fupi: subs r2, r2, #4 | ||
173 | addmi ip, r2, #4 | ||
174 | bmi .Lc2u_2nowords | ||
175 | mov r3, r7, pull #16 | ||
176 | ldr r7, [r1], #4 | ||
177 | orr r3, r3, r7, push #16 | ||
178 | USER( TUSER( str) r3, [r0], #4) @ May fault | ||
179 | mov ip, r0, lsl #32 - PAGE_SHIFT | ||
180 | rsb ip, ip, #0 | ||
181 | movs ip, ip, lsr #32 - PAGE_SHIFT | ||
182 | beq .Lc2u_2fupi | ||
183 | cmp r2, ip | ||
184 | movlt ip, r2 | ||
185 | sub r2, r2, ip | ||
186 | subs ip, ip, #16 | ||
187 | blt .Lc2u_2rem8lp | ||
188 | |||
189 | .Lc2u_2cpy8lp: mov r3, r7, pull #16 | ||
190 | ldmia r1!, {r4 - r7} | ||
191 | subs ip, ip, #16 | ||
192 | orr r3, r3, r4, push #16 | ||
193 | mov r4, r4, pull #16 | ||
194 | orr r4, r4, r5, push #16 | ||
195 | mov r5, r5, pull #16 | ||
196 | orr r5, r5, r6, push #16 | ||
197 | mov r6, r6, pull #16 | ||
198 | orr r6, r6, r7, push #16 | ||
199 | stmia r0!, {r3 - r6} @ Shouldnt fault | ||
200 | bpl .Lc2u_2cpy8lp | ||
201 | |||
202 | .Lc2u_2rem8lp: tst ip, #8 | ||
203 | movne r3, r7, pull #16 | ||
204 | ldmneia r1!, {r4, r7} | ||
205 | orrne r3, r3, r4, push #16 | ||
206 | movne r4, r4, pull #16 | ||
207 | orrne r4, r4, r7, push #16 | ||
208 | stmneia r0!, {r3 - r4} @ Shouldnt fault | ||
209 | tst ip, #4 | ||
210 | movne r3, r7, pull #16 | ||
211 | ldrne r7, [r1], #4 | ||
212 | orrne r3, r3, r7, push #16 | ||
213 | TUSER( strne) r3, [r0], #4 @ Shouldnt fault | ||
214 | ands ip, ip, #3 | ||
215 | beq .Lc2u_2fupi | ||
216 | .Lc2u_2nowords: mov r3, r7, get_byte_2 | ||
217 | teq ip, #0 | ||
218 | beq .Lc2u_finished | ||
219 | cmp ip, #2 | ||
220 | USER( TUSER( strb) r3, [r0], #1) @ May fault | ||
221 | movge r3, r7, get_byte_3 | ||
222 | USER( TUSER( strgeb) r3, [r0], #1) @ May fault | ||
223 | ldrgtb r3, [r1], #0 | ||
224 | USER( TUSER( strgtb) r3, [r0], #1) @ May fault | ||
225 | b .Lc2u_finished | ||
226 | |||
227 | .Lc2u_3fupi: subs r2, r2, #4 | ||
228 | addmi ip, r2, #4 | ||
229 | bmi .Lc2u_3nowords | ||
230 | mov r3, r7, pull #24 | ||
231 | ldr r7, [r1], #4 | ||
232 | orr r3, r3, r7, push #8 | ||
233 | USER( TUSER( str) r3, [r0], #4) @ May fault | ||
234 | mov ip, r0, lsl #32 - PAGE_SHIFT | ||
235 | rsb ip, ip, #0 | ||
236 | movs ip, ip, lsr #32 - PAGE_SHIFT | ||
237 | beq .Lc2u_3fupi | ||
238 | cmp r2, ip | ||
239 | movlt ip, r2 | ||
240 | sub r2, r2, ip | ||
241 | subs ip, ip, #16 | ||
242 | blt .Lc2u_3rem8lp | ||
243 | |||
244 | .Lc2u_3cpy8lp: mov r3, r7, pull #24 | ||
245 | ldmia r1!, {r4 - r7} | ||
246 | subs ip, ip, #16 | ||
247 | orr r3, r3, r4, push #8 | ||
248 | mov r4, r4, pull #24 | ||
249 | orr r4, r4, r5, push #8 | ||
250 | mov r5, r5, pull #24 | ||
251 | orr r5, r5, r6, push #8 | ||
252 | mov r6, r6, pull #24 | ||
253 | orr r6, r6, r7, push #8 | ||
254 | stmia r0!, {r3 - r6} @ Shouldnt fault | ||
255 | bpl .Lc2u_3cpy8lp | ||
256 | |||
257 | .Lc2u_3rem8lp: tst ip, #8 | ||
258 | movne r3, r7, pull #24 | ||
259 | ldmneia r1!, {r4, r7} | ||
260 | orrne r3, r3, r4, push #8 | ||
261 | movne r4, r4, pull #24 | ||
262 | orrne r4, r4, r7, push #8 | ||
263 | stmneia r0!, {r3 - r4} @ Shouldnt fault | ||
264 | tst ip, #4 | ||
265 | movne r3, r7, pull #24 | ||
266 | ldrne r7, [r1], #4 | ||
267 | orrne r3, r3, r7, push #8 | ||
268 | TUSER( strne) r3, [r0], #4 @ Shouldnt fault | ||
269 | ands ip, ip, #3 | ||
270 | beq .Lc2u_3fupi | ||
271 | .Lc2u_3nowords: mov r3, r7, get_byte_3 | ||
272 | teq ip, #0 | ||
273 | beq .Lc2u_finished | ||
274 | cmp ip, #2 | ||
275 | USER( TUSER( strb) r3, [r0], #1) @ May fault | ||
276 | ldrgeb r3, [r1], #1 | ||
277 | USER( TUSER( strgeb) r3, [r0], #1) @ May fault | ||
278 | ldrgtb r3, [r1], #0 | ||
279 | USER( TUSER( strgtb) r3, [r0], #1) @ May fault | ||
280 | b .Lc2u_finished | ||
281 | ENDPROC(__copy_to_user) | ||
282 | |||
283 | .pushsection .fixup,"ax" | ||
284 | .align 0 | ||
285 | 9001: ldmfd sp!, {r0, r4 - r7, pc} | ||
286 | .popsection | ||
287 | |||
288 | /* Prototype: unsigned long __copy_from_user(void *to,const void *from,unsigned long n); | ||
289 | * Purpose : copy a block from user memory to kernel memory | ||
290 | * Params : to - kernel memory | ||
291 | * : from - user memory | ||
292 | * : n - number of bytes to copy | ||
293 | * Returns : Number of bytes NOT copied. | ||
294 | */ | ||
295 | .Lcfu_dest_not_aligned: | ||
296 | rsb ip, ip, #4 | ||
297 | cmp ip, #2 | ||
298 | USER( TUSER( ldrb) r3, [r1], #1) @ May fault | ||
299 | strb r3, [r0], #1 | ||
300 | USER( TUSER( ldrgeb) r3, [r1], #1) @ May fault | ||
301 | strgeb r3, [r0], #1 | ||
302 | USER( TUSER( ldrgtb) r3, [r1], #1) @ May fault | ||
303 | strgtb r3, [r0], #1 | ||
304 | sub r2, r2, ip | ||
305 | b .Lcfu_dest_aligned | ||
306 | |||
307 | ENTRY(__copy_from_user) | ||
308 | stmfd sp!, {r0, r2, r4 - r7, lr} | ||
309 | cmp r2, #4 | ||
310 | blt .Lcfu_not_enough | ||
311 | ands ip, r0, #3 | ||
312 | bne .Lcfu_dest_not_aligned | ||
313 | .Lcfu_dest_aligned: | ||
314 | ands ip, r1, #3 | ||
315 | bne .Lcfu_src_not_aligned | ||
316 | |||
317 | /* | ||
318 | * Seeing as there has to be at least 8 bytes to copy, we can | ||
319 | * copy one word, and force a user-mode page fault... | ||
320 | */ | ||
321 | |||
322 | .Lcfu_0fupi: subs r2, r2, #4 | ||
323 | addmi ip, r2, #4 | ||
324 | bmi .Lcfu_0nowords | ||
325 | USER( TUSER( ldr) r3, [r1], #4) | ||
326 | str r3, [r0], #4 | ||
327 | mov ip, r1, lsl #32 - PAGE_SHIFT @ On each page, use a ld/st??t instruction | ||
328 | rsb ip, ip, #0 | ||
329 | movs ip, ip, lsr #32 - PAGE_SHIFT | ||
330 | beq .Lcfu_0fupi | ||
331 | /* | ||
332 | * ip = max no. of bytes to copy before needing another "strt" insn | ||
333 | */ | ||
334 | cmp r2, ip | ||
335 | movlt ip, r2 | ||
336 | sub r2, r2, ip | ||
337 | subs ip, ip, #32 | ||
338 | blt .Lcfu_0rem8lp | ||
339 | |||
340 | .Lcfu_0cpy8lp: ldmia r1!, {r3 - r6} @ Shouldnt fault | ||
341 | stmia r0!, {r3 - r6} | ||
342 | ldmia r1!, {r3 - r6} @ Shouldnt fault | ||
343 | subs ip, ip, #32 | ||
344 | stmia r0!, {r3 - r6} | ||
345 | bpl .Lcfu_0cpy8lp | ||
346 | |||
347 | .Lcfu_0rem8lp: cmn ip, #16 | ||
348 | ldmgeia r1!, {r3 - r6} @ Shouldnt fault | ||
349 | stmgeia r0!, {r3 - r6} | ||
350 | tst ip, #8 | ||
351 | ldmneia r1!, {r3 - r4} @ Shouldnt fault | ||
352 | stmneia r0!, {r3 - r4} | ||
353 | tst ip, #4 | ||
354 | TUSER( ldrne) r3, [r1], #4 @ Shouldnt fault | ||
355 | strne r3, [r0], #4 | ||
356 | ands ip, ip, #3 | ||
357 | beq .Lcfu_0fupi | ||
358 | .Lcfu_0nowords: teq ip, #0 | ||
359 | beq .Lcfu_finished | ||
360 | .Lcfu_nowords: cmp ip, #2 | ||
361 | USER( TUSER( ldrb) r3, [r1], #1) @ May fault | ||
362 | strb r3, [r0], #1 | ||
363 | USER( TUSER( ldrgeb) r3, [r1], #1) @ May fault | ||
364 | strgeb r3, [r0], #1 | ||
365 | USER( TUSER( ldrgtb) r3, [r1], #1) @ May fault | ||
366 | strgtb r3, [r0], #1 | ||
367 | b .Lcfu_finished | ||
368 | |||
369 | .Lcfu_not_enough: | ||
370 | movs ip, r2 | ||
371 | bne .Lcfu_nowords | ||
372 | .Lcfu_finished: mov r0, #0 | ||
373 | add sp, sp, #8 | ||
374 | ldmfd sp!, {r4 - r7, pc} | ||
375 | |||
376 | .Lcfu_src_not_aligned: | ||
377 | bic r1, r1, #3 | ||
378 | USER( TUSER( ldr) r7, [r1], #4) @ May fault | ||
379 | cmp ip, #2 | ||
380 | bgt .Lcfu_3fupi | ||
381 | beq .Lcfu_2fupi | ||
382 | .Lcfu_1fupi: subs r2, r2, #4 | ||
383 | addmi ip, r2, #4 | ||
384 | bmi .Lcfu_1nowords | ||
385 | mov r3, r7, pull #8 | ||
386 | USER( TUSER( ldr) r7, [r1], #4) @ May fault | ||
387 | orr r3, r3, r7, push #24 | ||
388 | str r3, [r0], #4 | ||
389 | mov ip, r1, lsl #32 - PAGE_SHIFT | ||
390 | rsb ip, ip, #0 | ||
391 | movs ip, ip, lsr #32 - PAGE_SHIFT | ||
392 | beq .Lcfu_1fupi | ||
393 | cmp r2, ip | ||
394 | movlt ip, r2 | ||
395 | sub r2, r2, ip | ||
396 | subs ip, ip, #16 | ||
397 | blt .Lcfu_1rem8lp | ||
398 | |||
399 | .Lcfu_1cpy8lp: mov r3, r7, pull #8 | ||
400 | ldmia r1!, {r4 - r7} @ Shouldnt fault | ||
401 | subs ip, ip, #16 | ||
402 | orr r3, r3, r4, push #24 | ||
403 | mov r4, r4, pull #8 | ||
404 | orr r4, r4, r5, push #24 | ||
405 | mov r5, r5, pull #8 | ||
406 | orr r5, r5, r6, push #24 | ||
407 | mov r6, r6, pull #8 | ||
408 | orr r6, r6, r7, push #24 | ||
409 | stmia r0!, {r3 - r6} | ||
410 | bpl .Lcfu_1cpy8lp | ||
411 | |||
412 | .Lcfu_1rem8lp: tst ip, #8 | ||
413 | movne r3, r7, pull #8 | ||
414 | ldmneia r1!, {r4, r7} @ Shouldnt fault | ||
415 | orrne r3, r3, r4, push #24 | ||
416 | movne r4, r4, pull #8 | ||
417 | orrne r4, r4, r7, push #24 | ||
418 | stmneia r0!, {r3 - r4} | ||
419 | tst ip, #4 | ||
420 | movne r3, r7, pull #8 | ||
421 | USER( TUSER( ldrne) r7, [r1], #4) @ May fault | ||
422 | orrne r3, r3, r7, push #24 | ||
423 | strne r3, [r0], #4 | ||
424 | ands ip, ip, #3 | ||
425 | beq .Lcfu_1fupi | ||
426 | .Lcfu_1nowords: mov r3, r7, get_byte_1 | ||
427 | teq ip, #0 | ||
428 | beq .Lcfu_finished | ||
429 | cmp ip, #2 | ||
430 | strb r3, [r0], #1 | ||
431 | movge r3, r7, get_byte_2 | ||
432 | strgeb r3, [r0], #1 | ||
433 | movgt r3, r7, get_byte_3 | ||
434 | strgtb r3, [r0], #1 | ||
435 | b .Lcfu_finished | ||
436 | |||
437 | .Lcfu_2fupi: subs r2, r2, #4 | ||
438 | addmi ip, r2, #4 | ||
439 | bmi .Lcfu_2nowords | ||
440 | mov r3, r7, pull #16 | ||
441 | USER( TUSER( ldr) r7, [r1], #4) @ May fault | ||
442 | orr r3, r3, r7, push #16 | ||
443 | str r3, [r0], #4 | ||
444 | mov ip, r1, lsl #32 - PAGE_SHIFT | ||
445 | rsb ip, ip, #0 | ||
446 | movs ip, ip, lsr #32 - PAGE_SHIFT | ||
447 | beq .Lcfu_2fupi | ||
448 | cmp r2, ip | ||
449 | movlt ip, r2 | ||
450 | sub r2, r2, ip | ||
451 | subs ip, ip, #16 | ||
452 | blt .Lcfu_2rem8lp | ||
453 | |||
454 | |||
455 | .Lcfu_2cpy8lp: mov r3, r7, pull #16 | ||
456 | ldmia r1!, {r4 - r7} @ Shouldnt fault | ||
457 | subs ip, ip, #16 | ||
458 | orr r3, r3, r4, push #16 | ||
459 | mov r4, r4, pull #16 | ||
460 | orr r4, r4, r5, push #16 | ||
461 | mov r5, r5, pull #16 | ||
462 | orr r5, r5, r6, push #16 | ||
463 | mov r6, r6, pull #16 | ||
464 | orr r6, r6, r7, push #16 | ||
465 | stmia r0!, {r3 - r6} | ||
466 | bpl .Lcfu_2cpy8lp | ||
467 | |||
468 | .Lcfu_2rem8lp: tst ip, #8 | ||
469 | movne r3, r7, pull #16 | ||
470 | ldmneia r1!, {r4, r7} @ Shouldnt fault | ||
471 | orrne r3, r3, r4, push #16 | ||
472 | movne r4, r4, pull #16 | ||
473 | orrne r4, r4, r7, push #16 | ||
474 | stmneia r0!, {r3 - r4} | ||
475 | tst ip, #4 | ||
476 | movne r3, r7, pull #16 | ||
477 | USER( TUSER( ldrne) r7, [r1], #4) @ May fault | ||
478 | orrne r3, r3, r7, push #16 | ||
479 | strne r3, [r0], #4 | ||
480 | ands ip, ip, #3 | ||
481 | beq .Lcfu_2fupi | ||
482 | .Lcfu_2nowords: mov r3, r7, get_byte_2 | ||
483 | teq ip, #0 | ||
484 | beq .Lcfu_finished | ||
485 | cmp ip, #2 | ||
486 | strb r3, [r0], #1 | ||
487 | movge r3, r7, get_byte_3 | ||
488 | strgeb r3, [r0], #1 | ||
489 | USER( TUSER( ldrgtb) r3, [r1], #0) @ May fault | ||
490 | strgtb r3, [r0], #1 | ||
491 | b .Lcfu_finished | ||
492 | |||
493 | .Lcfu_3fupi: subs r2, r2, #4 | ||
494 | addmi ip, r2, #4 | ||
495 | bmi .Lcfu_3nowords | ||
496 | mov r3, r7, pull #24 | ||
497 | USER( TUSER( ldr) r7, [r1], #4) @ May fault | ||
498 | orr r3, r3, r7, push #8 | ||
499 | str r3, [r0], #4 | ||
500 | mov ip, r1, lsl #32 - PAGE_SHIFT | ||
501 | rsb ip, ip, #0 | ||
502 | movs ip, ip, lsr #32 - PAGE_SHIFT | ||
503 | beq .Lcfu_3fupi | ||
504 | cmp r2, ip | ||
505 | movlt ip, r2 | ||
506 | sub r2, r2, ip | ||
507 | subs ip, ip, #16 | ||
508 | blt .Lcfu_3rem8lp | ||
509 | |||
510 | .Lcfu_3cpy8lp: mov r3, r7, pull #24 | ||
511 | ldmia r1!, {r4 - r7} @ Shouldnt fault | ||
512 | orr r3, r3, r4, push #8 | ||
513 | mov r4, r4, pull #24 | ||
514 | orr r4, r4, r5, push #8 | ||
515 | mov r5, r5, pull #24 | ||
516 | orr r5, r5, r6, push #8 | ||
517 | mov r6, r6, pull #24 | ||
518 | orr r6, r6, r7, push #8 | ||
519 | stmia r0!, {r3 - r6} | ||
520 | subs ip, ip, #16 | ||
521 | bpl .Lcfu_3cpy8lp | ||
522 | |||
523 | .Lcfu_3rem8lp: tst ip, #8 | ||
524 | movne r3, r7, pull #24 | ||
525 | ldmneia r1!, {r4, r7} @ Shouldnt fault | ||
526 | orrne r3, r3, r4, push #8 | ||
527 | movne r4, r4, pull #24 | ||
528 | orrne r4, r4, r7, push #8 | ||
529 | stmneia r0!, {r3 - r4} | ||
530 | tst ip, #4 | ||
531 | movne r3, r7, pull #24 | ||
532 | USER( TUSER( ldrne) r7, [r1], #4) @ May fault | ||
533 | orrne r3, r3, r7, push #8 | ||
534 | strne r3, [r0], #4 | ||
535 | ands ip, ip, #3 | ||
536 | beq .Lcfu_3fupi | ||
537 | .Lcfu_3nowords: mov r3, r7, get_byte_3 | ||
538 | teq ip, #0 | ||
539 | beq .Lcfu_finished | ||
540 | cmp ip, #2 | ||
541 | strb r3, [r0], #1 | ||
542 | USER( TUSER( ldrgeb) r3, [r1], #1) @ May fault | ||
543 | strgeb r3, [r0], #1 | ||
544 | USER( TUSER( ldrgtb) r3, [r1], #1) @ May fault | ||
545 | strgtb r3, [r0], #1 | ||
546 | b .Lcfu_finished | ||
547 | ENDPROC(__copy_from_user) | ||
548 | |||
549 | .pushsection .fixup,"ax" | ||
550 | .align 0 | ||
551 | /* | ||
552 | * We took an exception. r0 contains a pointer to | ||
553 | * the byte not copied. | ||
554 | */ | ||
555 | 9001: ldr r2, [sp], #4 @ void *to | ||
556 | sub r2, r0, r2 @ bytes copied | ||
557 | ldr r1, [sp], #4 @ unsigned long count | ||
558 | subs r4, r1, r2 @ bytes left to copy | ||
559 | movne r1, r4 | ||
560 | blne __memzero | ||
561 | mov r0, r4 | ||
562 | ldmfd sp!, {r4 - r7, pc} | ||
563 | .popsection | ||
564 | |||
diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c index 77458548e031..40ca11ed6e5f 100644 --- a/arch/arm/mm/flush.c +++ b/arch/arm/mm/flush.c | |||
@@ -231,8 +231,6 @@ void __sync_icache_dcache(pte_t pteval) | |||
231 | struct page *page; | 231 | struct page *page; |
232 | struct address_space *mapping; | 232 | struct address_space *mapping; |
233 | 233 | ||
234 | if (!pte_present_user(pteval)) | ||
235 | return; | ||
236 | if (cache_is_vipt_nonaliasing() && !pte_exec(pteval)) | 234 | if (cache_is_vipt_nonaliasing() && !pte_exec(pteval)) |
237 | /* only flush non-aliasing VIPT caches for exec mappings */ | 235 | /* only flush non-aliasing VIPT caches for exec mappings */ |
238 | return; | 236 | return; |
diff --git a/arch/arm/mm/tlb-v7.S b/arch/arm/mm/tlb-v7.S index c2021139cb56..ea94765acf9a 100644 --- a/arch/arm/mm/tlb-v7.S +++ b/arch/arm/mm/tlb-v7.S | |||
@@ -38,10 +38,10 @@ ENTRY(v7wbi_flush_user_tlb_range) | |||
38 | dsb | 38 | dsb |
39 | mov r0, r0, lsr #PAGE_SHIFT @ align address | 39 | mov r0, r0, lsr #PAGE_SHIFT @ align address |
40 | mov r1, r1, lsr #PAGE_SHIFT | 40 | mov r1, r1, lsr #PAGE_SHIFT |
41 | #ifdef CONFIG_ARM_ERRATA_720789 | ||
42 | mov r3, #0 | ||
43 | #else | ||
44 | asid r3, r3 @ mask ASID | 41 | asid r3, r3 @ mask ASID |
42 | #ifdef CONFIG_ARM_ERRATA_720789 | ||
43 | ALT_SMP(W(mov) r3, #0 ) | ||
44 | ALT_UP(W(nop) ) | ||
45 | #endif | 45 | #endif |
46 | orr r0, r3, r0, lsl #PAGE_SHIFT @ Create initial MVA | 46 | orr r0, r3, r0, lsl #PAGE_SHIFT @ Create initial MVA |
47 | mov r1, r1, lsl #PAGE_SHIFT | 47 | mov r1, r1, lsl #PAGE_SHIFT |
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c index fb849d044bde..c834b32af275 100644 --- a/arch/arm/vfp/vfpmodule.c +++ b/arch/arm/vfp/vfpmodule.c | |||
@@ -719,8 +719,10 @@ static int __init vfp_init(void) | |||
719 | if ((fmrx(MVFR1) & 0x000fff00) == 0x00011100) | 719 | if ((fmrx(MVFR1) & 0x000fff00) == 0x00011100) |
720 | elf_hwcap |= HWCAP_NEON; | 720 | elf_hwcap |= HWCAP_NEON; |
721 | #endif | 721 | #endif |
722 | #ifdef CONFIG_VFPv3 | ||
722 | if ((fmrx(MVFR1) & 0xf0000000) == 0x10000000) | 723 | if ((fmrx(MVFR1) & 0xf0000000) == 0x10000000) |
723 | elf_hwcap |= HWCAP_VFPv4; | 724 | elf_hwcap |= HWCAP_VFPv4; |
725 | #endif | ||
724 | } | 726 | } |
725 | } | 727 | } |
726 | return 0; | 728 | return 0; |