aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2009-07-24 07:32:57 -0400
committerCatalin Marinas <catalin.marinas@arm.com>2009-07-24 07:32:57 -0400
commit8b592783a2e8b7721a99730bd549aab5208f36af (patch)
tree468636a17d31f6a29287240c63234e739eabf666 /arch
parent347c8b70b1d5256e445e54e736f88d21877616cf (diff)
Thumb-2: Implement the unified arch/arm/lib functions
This patch adds the ARM/Thumb-2 unified support for the arch/arm/lib/* files. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/include/asm/assembler.h73
-rw-r--r--arch/arm/include/asm/uaccess.h7
-rw-r--r--arch/arm/lib/ashldi3.S4
-rw-r--r--arch/arm/lib/ashrdi3.S4
-rw-r--r--arch/arm/lib/backtrace.S8
-rw-r--r--arch/arm/lib/clear_user.S15
-rw-r--r--arch/arm/lib/copy_from_user.S19
-rw-r--r--arch/arm/lib/copy_template.S24
-rw-r--r--arch/arm/lib/copy_to_user.S19
-rw-r--r--arch/arm/lib/csumpartialcopyuser.S48
-rw-r--r--arch/arm/lib/div64.S4
-rw-r--r--arch/arm/lib/findbit.S34
-rw-r--r--arch/arm/lib/getuser.S5
-rw-r--r--arch/arm/lib/io-writesw-armv4.S5
-rw-r--r--arch/arm/lib/lshrdi3.S4
-rw-r--r--arch/arm/lib/memcpy.S7
-rw-r--r--arch/arm/lib/memmove.S28
-rw-r--r--arch/arm/lib/putuser.S15
-rw-r--r--arch/arm/lib/strncpy_from_user.S2
-rw-r--r--arch/arm/lib/strnlen_user.S2
20 files changed, 229 insertions, 98 deletions
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index 1acd1da36d00..2b60c7d05770 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -138,3 +138,76 @@
138 msr cpsr_c, #\mode 138 msr cpsr_c, #\mode
139 .endm 139 .endm
140#endif 140#endif
141
142/*
143 * STRT/LDRT access macros with ARM and Thumb-2 variants
144 */
145#ifdef CONFIG_THUMB2_KERNEL
146
147 .macro usraccoff, instr, reg, ptr, inc, off, cond, abort
1489999:
149 .if \inc == 1
150 \instr\cond\()bt \reg, [\ptr, #\off]
151 .elseif \inc == 4
152 \instr\cond\()t \reg, [\ptr, #\off]
153 .else
154 .error "Unsupported inc macro argument"
155 .endif
156
157 .section __ex_table,"a"
158 .align 3
159 .long 9999b, \abort
160 .previous
161 .endm
162
163 .macro usracc, instr, reg, ptr, inc, cond, rept, abort
164 @ explicit IT instruction needed because of the label
165 @ introduced by the USER macro
166 .ifnc \cond,al
167 .if \rept == 1
168 itt \cond
169 .elseif \rept == 2
170 ittt \cond
171 .else
172 .error "Unsupported rept macro argument"
173 .endif
174 .endif
175
176 @ Slightly optimised to avoid incrementing the pointer twice
177 usraccoff \instr, \reg, \ptr, \inc, 0, \cond, \abort
178 .if \rept == 2
179 usraccoff \instr, \reg, \ptr, \inc, 4, \cond, \abort
180 .endif
181
182 add\cond \ptr, #\rept * \inc
183 .endm
184
185#else /* !CONFIG_THUMB2_KERNEL */
186
187 .macro usracc, instr, reg, ptr, inc, cond, rept, abort
188 .rept \rept
1899999:
190 .if \inc == 1
191 \instr\cond\()bt \reg, [\ptr], #\inc
192 .elseif \inc == 4
193 \instr\cond\()t \reg, [\ptr], #\inc
194 .else
195 .error "Unsupported inc macro argument"
196 .endif
197
198 .section __ex_table,"a"
199 .align 3
200 .long 9999b, \abort
201 .previous
202 .endr
203 .endm
204
205#endif /* CONFIG_THUMB2_KERNEL */
206
207 .macro strusr, reg, ptr, inc, cond=al, rept=1, abort=9001f
208 usracc str, \reg, \ptr, \inc, \cond, \rept, \abort
209 .endm
210
211 .macro ldrusr, reg, ptr, inc, cond=al, rept=1, abort=9001f
212 usracc ldr, \reg, \ptr, \inc, \cond, \rept, \abort
213 .endm
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
index 0da9bc9b3b1d..1d6bd40a4322 100644
--- a/arch/arm/include/asm/uaccess.h
+++ b/arch/arm/include/asm/uaccess.h
@@ -17,6 +17,7 @@
17#include <asm/memory.h> 17#include <asm/memory.h>
18#include <asm/domain.h> 18#include <asm/domain.h>
19#include <asm/system.h> 19#include <asm/system.h>
20#include <asm/unified.h>
20 21
21#define VERIFY_READ 0 22#define VERIFY_READ 0
22#define VERIFY_WRITE 1 23#define VERIFY_WRITE 1
@@ -365,8 +366,10 @@ do { \
365 366
366#define __put_user_asm_dword(x,__pu_addr,err) \ 367#define __put_user_asm_dword(x,__pu_addr,err) \
367 __asm__ __volatile__( \ 368 __asm__ __volatile__( \
368 "1: strt " __reg_oper1 ", [%1], #4\n" \ 369 ARM( "1: strt " __reg_oper1 ", [%1], #4\n" ) \
369 "2: strt " __reg_oper0 ", [%1]\n" \ 370 ARM( "2: strt " __reg_oper0 ", [%1]\n" ) \
371 THUMB( "1: strt " __reg_oper1 ", [%1]\n" ) \
372 THUMB( "2: strt " __reg_oper0 ", [%1, #4]\n" ) \
370 "3:\n" \ 373 "3:\n" \
371 " .section .fixup,\"ax\"\n" \ 374 " .section .fixup,\"ax\"\n" \
372 " .align 2\n" \ 375 " .align 2\n" \
diff --git a/arch/arm/lib/ashldi3.S b/arch/arm/lib/ashldi3.S
index 1154d924080b..638deb13da1c 100644
--- a/arch/arm/lib/ashldi3.S
+++ b/arch/arm/lib/ashldi3.S
@@ -43,7 +43,9 @@ ENTRY(__aeabi_llsl)
43 rsb ip, r2, #32 43 rsb ip, r2, #32
44 movmi ah, ah, lsl r2 44 movmi ah, ah, lsl r2
45 movpl ah, al, lsl r3 45 movpl ah, al, lsl r3
46 orrmi ah, ah, al, lsr ip 46 ARM( orrmi ah, ah, al, lsr ip )
47 THUMB( lsrmi r3, al, ip )
48 THUMB( orrmi ah, ah, r3 )
47 mov al, al, lsl r2 49 mov al, al, lsl r2
48 mov pc, lr 50 mov pc, lr
49 51
diff --git a/arch/arm/lib/ashrdi3.S b/arch/arm/lib/ashrdi3.S
index 9f8b35572f8c..015e8aa5a1d1 100644
--- a/arch/arm/lib/ashrdi3.S
+++ b/arch/arm/lib/ashrdi3.S
@@ -43,7 +43,9 @@ ENTRY(__aeabi_lasr)
43 rsb ip, r2, #32 43 rsb ip, r2, #32
44 movmi al, al, lsr r2 44 movmi al, al, lsr r2
45 movpl al, ah, asr r3 45 movpl al, ah, asr r3
46 orrmi al, al, ah, lsl ip 46 ARM( orrmi al, al, ah, lsl ip )
47 THUMB( lslmi r3, ah, ip )
48 THUMB( orrmi al, al, r3 )
47 mov ah, ah, asr r2 49 mov ah, ah, asr r2
48 mov pc, lr 50 mov pc, lr
49 51
diff --git a/arch/arm/lib/backtrace.S b/arch/arm/lib/backtrace.S
index b0951d0e8b2c..aaf7220d9e30 100644
--- a/arch/arm/lib/backtrace.S
+++ b/arch/arm/lib/backtrace.S
@@ -38,7 +38,9 @@ ENDPROC(c_backtrace)
38 beq no_frame @ we have no stack frames 38 beq no_frame @ we have no stack frames
39 39
40 tst r1, #0x10 @ 26 or 32-bit mode? 40 tst r1, #0x10 @ 26 or 32-bit mode?
41 moveq mask, #0xfc000003 @ mask for 26-bit 41 ARM( moveq mask, #0xfc000003 )
42 THUMB( moveq mask, #0xfc000000 )
43 THUMB( orreq mask, #0x03 )
42 movne mask, #0 @ mask for 32-bit 44 movne mask, #0 @ mask for 32-bit
43 45
441: stmfd sp!, {pc} @ calculate offset of PC stored 461: stmfd sp!, {pc} @ calculate offset of PC stored
@@ -126,7 +128,9 @@ ENDPROC(c_backtrace)
126 mov reg, #10 128 mov reg, #10
127 mov r7, #0 129 mov r7, #0
1281: mov r3, #1 1301: mov r3, #1
129 tst instr, r3, lsl reg 131 ARM( tst instr, r3, lsl reg )
132 THUMB( lsl r3, reg )
133 THUMB( tst instr, r3 )
130 beq 2f 134 beq 2f
131 add r7, r7, #1 135 add r7, r7, #1
132 teq r7, #6 136 teq r7, #6
diff --git a/arch/arm/lib/clear_user.S b/arch/arm/lib/clear_user.S
index 844f56785ebc..1279abd8b886 100644
--- a/arch/arm/lib/clear_user.S
+++ b/arch/arm/lib/clear_user.S
@@ -27,21 +27,20 @@ WEAK(__clear_user)
27 ands ip, r0, #3 27 ands ip, r0, #3
28 beq 1f 28 beq 1f
29 cmp ip, #2 29 cmp ip, #2
30USER( strbt r2, [r0], #1) 30 strusr r2, r0, 1
31USER( strlebt r2, [r0], #1) 31 strusr r2, r0, 1, le
32USER( strltbt r2, [r0], #1) 32 strusr r2, r0, 1, lt
33 rsb ip, ip, #4 33 rsb ip, ip, #4
34 sub r1, r1, ip @ 7 6 5 4 3 2 1 34 sub r1, r1, ip @ 7 6 5 4 3 2 1
351: subs r1, r1, #8 @ -1 -2 -3 -4 -5 -6 -7 351: subs r1, r1, #8 @ -1 -2 -3 -4 -5 -6 -7
36USER( strplt r2, [r0], #4) 36 strusr r2, r0, 4, pl, rept=2
37USER( strplt r2, [r0], #4)
38 bpl 1b 37 bpl 1b
39 adds r1, r1, #4 @ 3 2 1 0 -1 -2 -3 38 adds r1, r1, #4 @ 3 2 1 0 -1 -2 -3
40USER( strplt r2, [r0], #4) 39 strusr r2, r0, 4, pl
412: tst r1, #2 @ 1x 1x 0x 0x 1x 1x 0x 402: tst r1, #2 @ 1x 1x 0x 0x 1x 1x 0x
42USER( strnebt r2, [r0], #1) 41 strusr r2, r0, 1, ne, rept=2
43USER( strnebt r2, [r0], #1)
44 tst r1, #1 @ x1 x0 x1 x0 x1 x0 x1 42 tst r1, #1 @ x1 x0 x1 x0 x1 x0 x1
43 it ne @ explicit IT needed for the label
45USER( strnebt r2, [r0]) 44USER( strnebt r2, [r0])
46 mov r0, #0 45 mov r0, #0
47 ldmfd sp!, {r1, pc} 46 ldmfd sp!, {r1, pc}
diff --git a/arch/arm/lib/copy_from_user.S b/arch/arm/lib/copy_from_user.S
index 56799a165cc4..e4fe124acedc 100644
--- a/arch/arm/lib/copy_from_user.S
+++ b/arch/arm/lib/copy_from_user.S
@@ -33,11 +33,15 @@
33 * Number of bytes NOT copied. 33 * Number of bytes NOT copied.
34 */ 34 */
35 35
36#ifndef CONFIG_THUMB2_KERNEL
37#define LDR1W_SHIFT 0
38#else
39#define LDR1W_SHIFT 1
40#endif
41#define STR1W_SHIFT 0
42
36 .macro ldr1w ptr reg abort 43 .macro ldr1w ptr reg abort
37100: ldrt \reg, [\ptr], #4 44 ldrusr \reg, \ptr, 4, abort=\abort
38 .section __ex_table, "a"
39 .long 100b, \abort
40 .previous
41 .endm 45 .endm
42 46
43 .macro ldr4w ptr reg1 reg2 reg3 reg4 abort 47 .macro ldr4w ptr reg1 reg2 reg3 reg4 abort
@@ -53,14 +57,11 @@
53 .endm 57 .endm
54 58
55 .macro ldr1b ptr reg cond=al abort 59 .macro ldr1b ptr reg cond=al abort
56100: ldr\cond\()bt \reg, [\ptr], #1 60 ldrusr \reg, \ptr, 1, \cond, abort=\abort
57 .section __ex_table, "a"
58 .long 100b, \abort
59 .previous
60 .endm 61 .endm
61 62
62 .macro str1w ptr reg abort 63 .macro str1w ptr reg abort
63 str \reg, [\ptr], #4 64 W(str) \reg, [\ptr], #4
64 .endm 65 .endm
65 66
66 .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort 67 .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
diff --git a/arch/arm/lib/copy_template.S b/arch/arm/lib/copy_template.S
index 139cce646055..805e3f8fb007 100644
--- a/arch/arm/lib/copy_template.S
+++ b/arch/arm/lib/copy_template.S
@@ -57,6 +57,13 @@
57 * 57 *
58 * Restore registers with the values previously saved with the 58 * Restore registers with the values previously saved with the
59 * 'preserv' macro. Called upon code termination. 59 * 'preserv' macro. Called upon code termination.
60 *
61 * LDR1W_SHIFT
62 * STR1W_SHIFT
63 *
64 * Correction to be applied to the "ip" register when branching into
65 * the ldr1w or str1w instructions (some of these macros may expand to
66 * than one 32bit instruction in Thumb-2)
60 */ 67 */
61 68
62 69
@@ -99,9 +106,15 @@
99 106
1005: ands ip, r2, #28 1075: ands ip, r2, #28
101 rsb ip, ip, #32 108 rsb ip, ip, #32
109#if LDR1W_SHIFT > 0
110 lsl ip, ip, #LDR1W_SHIFT
111#endif
102 addne pc, pc, ip @ C is always clear here 112 addne pc, pc, ip @ C is always clear here
103 b 7f 113 b 7f
1046: nop 1146:
115 .rept (1 << LDR1W_SHIFT)
116 W(nop)
117 .endr
105 ldr1w r1, r3, abort=20f 118 ldr1w r1, r3, abort=20f
106 ldr1w r1, r4, abort=20f 119 ldr1w r1, r4, abort=20f
107 ldr1w r1, r5, abort=20f 120 ldr1w r1, r5, abort=20f
@@ -110,9 +123,16 @@
110 ldr1w r1, r8, abort=20f 123 ldr1w r1, r8, abort=20f
111 ldr1w r1, lr, abort=20f 124 ldr1w r1, lr, abort=20f
112 125
126#if LDR1W_SHIFT < STR1W_SHIFT
127 lsl ip, ip, #STR1W_SHIFT - LDR1W_SHIFT
128#elif LDR1W_SHIFT > STR1W_SHIFT
129 lsr ip, ip, #LDR1W_SHIFT - STR1W_SHIFT
130#endif
113 add pc, pc, ip 131 add pc, pc, ip
114 nop 132 nop
115 nop 133 .rept (1 << STR1W_SHIFT)
134 W(nop)
135 .endr
116 str1w r0, r3, abort=20f 136 str1w r0, r3, abort=20f
117 str1w r0, r4, abort=20f 137 str1w r0, r4, abort=20f
118 str1w r0, r5, abort=20f 138 str1w r0, r5, abort=20f
diff --git a/arch/arm/lib/copy_to_user.S b/arch/arm/lib/copy_to_user.S
index 878820f0a320..1a71e1584442 100644
--- a/arch/arm/lib/copy_to_user.S
+++ b/arch/arm/lib/copy_to_user.S
@@ -33,8 +33,15 @@
33 * Number of bytes NOT copied. 33 * Number of bytes NOT copied.
34 */ 34 */
35 35
36#define LDR1W_SHIFT 0
37#ifndef CONFIG_THUMB2_KERNEL
38#define STR1W_SHIFT 0
39#else
40#define STR1W_SHIFT 1
41#endif
42
36 .macro ldr1w ptr reg abort 43 .macro ldr1w ptr reg abort
37 ldr \reg, [\ptr], #4 44 W(ldr) \reg, [\ptr], #4
38 .endm 45 .endm
39 46
40 .macro ldr4w ptr reg1 reg2 reg3 reg4 abort 47 .macro ldr4w ptr reg1 reg2 reg3 reg4 abort
@@ -50,10 +57,7 @@
50 .endm 57 .endm
51 58
52 .macro str1w ptr reg abort 59 .macro str1w ptr reg abort
53100: strt \reg, [\ptr], #4 60 strusr \reg, \ptr, 4, abort=\abort
54 .section __ex_table, "a"
55 .long 100b, \abort
56 .previous
57 .endm 61 .endm
58 62
59 .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort 63 .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
@@ -68,10 +72,7 @@
68 .endm 72 .endm
69 73
70 .macro str1b ptr reg cond=al abort 74 .macro str1b ptr reg cond=al abort
71100: str\cond\()bt \reg, [\ptr], #1 75 strusr \reg, \ptr, 1, \cond, abort=\abort
72 .section __ex_table, "a"
73 .long 100b, \abort
74 .previous
75 .endm 76 .endm
76 77
77 .macro enter reg1 reg2 78 .macro enter reg1 reg2
diff --git a/arch/arm/lib/csumpartialcopyuser.S b/arch/arm/lib/csumpartialcopyuser.S
index 14677fb4b0c4..fd0e9dcd9fdc 100644
--- a/arch/arm/lib/csumpartialcopyuser.S
+++ b/arch/arm/lib/csumpartialcopyuser.S
@@ -26,50 +26,28 @@
26 .endm 26 .endm
27 27
28 .macro load1b, reg1 28 .macro load1b, reg1
299999: ldrbt \reg1, [r0], $1 29 ldrusr \reg1, r0, 1
30 .section __ex_table, "a"
31 .align 3
32 .long 9999b, 6001f
33 .previous
34 .endm 30 .endm
35 31
36 .macro load2b, reg1, reg2 32 .macro load2b, reg1, reg2
379999: ldrbt \reg1, [r0], $1 33 ldrusr \reg1, r0, 1
389998: ldrbt \reg2, [r0], $1 34 ldrusr \reg2, r0, 1
39 .section __ex_table, "a"
40 .long 9999b, 6001f
41 .long 9998b, 6001f
42 .previous
43 .endm 35 .endm
44 36
45 .macro load1l, reg1 37 .macro load1l, reg1
469999: ldrt \reg1, [r0], $4 38 ldrusr \reg1, r0, 4
47 .section __ex_table, "a"
48 .align 3
49 .long 9999b, 6001f
50 .previous
51 .endm 39 .endm
52 40
53 .macro load2l, reg1, reg2 41 .macro load2l, reg1, reg2
549999: ldrt \reg1, [r0], $4 42 ldrusr \reg1, r0, 4
559998: ldrt \reg2, [r0], $4 43 ldrusr \reg2, r0, 4
56 .section __ex_table, "a"
57 .long 9999b, 6001f
58 .long 9998b, 6001f
59 .previous
60 .endm 44 .endm
61 45
62 .macro load4l, reg1, reg2, reg3, reg4 46 .macro load4l, reg1, reg2, reg3, reg4
639999: ldrt \reg1, [r0], $4 47 ldrusr \reg1, r0, 4
649998: ldrt \reg2, [r0], $4 48 ldrusr \reg2, r0, 4
659997: ldrt \reg3, [r0], $4 49 ldrusr \reg3, r0, 4
669996: ldrt \reg4, [r0], $4 50 ldrusr \reg4, r0, 4
67 .section __ex_table, "a"
68 .long 9999b, 6001f
69 .long 9998b, 6001f
70 .long 9997b, 6001f
71 .long 9996b, 6001f
72 .previous
73 .endm 51 .endm
74 52
75/* 53/*
@@ -92,14 +70,14 @@
92 */ 70 */
93 .section .fixup,"ax" 71 .section .fixup,"ax"
94 .align 4 72 .align 4
956001: mov r4, #-EFAULT 739001: mov r4, #-EFAULT
96 ldr r5, [fp, #4] @ *err_ptr 74 ldr r5, [fp, #4] @ *err_ptr
97 str r4, [r5] 75 str r4, [r5]
98 ldmia sp, {r1, r2} @ retrieve dst, len 76 ldmia sp, {r1, r2} @ retrieve dst, len
99 add r2, r2, r1 77 add r2, r2, r1
100 mov r0, #0 @ zero the buffer 78 mov r0, #0 @ zero the buffer
1016002: teq r2, r1 799002: teq r2, r1
102 strneb r0, [r1], #1 80 strneb r0, [r1], #1
103 bne 6002b 81 bne 9002b
104 load_regs 82 load_regs
105 .previous 83 .previous
diff --git a/arch/arm/lib/div64.S b/arch/arm/lib/div64.S
index 1425e789ba86..faa7748142da 100644
--- a/arch/arm/lib/div64.S
+++ b/arch/arm/lib/div64.S
@@ -177,7 +177,9 @@ ENTRY(__do_div64)
177 mov yh, xh, lsr ip 177 mov yh, xh, lsr ip
178 mov yl, xl, lsr ip 178 mov yl, xl, lsr ip
179 rsb ip, ip, #32 179 rsb ip, ip, #32
180 orr yl, yl, xh, lsl ip 180 ARM( orr yl, yl, xh, lsl ip )
181 THUMB( lsl xh, xh, ip )
182 THUMB( orr yl, yl, xh )
181 mov xh, xl, lsl ip 183 mov xh, xl, lsl ip
182 mov xh, xh, lsr ip 184 mov xh, xh, lsr ip
183 mov pc, lr 185 mov pc, lr
diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S
index 8c4defc4f3c4..1e4cbd4e7be9 100644
--- a/arch/arm/lib/findbit.S
+++ b/arch/arm/lib/findbit.S
@@ -25,7 +25,10 @@ ENTRY(_find_first_zero_bit_le)
25 teq r1, #0 25 teq r1, #0
26 beq 3f 26 beq 3f
27 mov r2, #0 27 mov r2, #0
281: ldrb r3, [r0, r2, lsr #3] 281:
29 ARM( ldrb r3, [r0, r2, lsr #3] )
30 THUMB( lsr r3, r2, #3 )
31 THUMB( ldrb r3, [r0, r3] )
29 eors r3, r3, #0xff @ invert bits 32 eors r3, r3, #0xff @ invert bits
30 bne .L_found @ any now set - found zero bit 33 bne .L_found @ any now set - found zero bit
31 add r2, r2, #8 @ next bit pointer 34 add r2, r2, #8 @ next bit pointer
@@ -44,7 +47,9 @@ ENTRY(_find_next_zero_bit_le)
44 beq 3b 47 beq 3b
45 ands ip, r2, #7 48 ands ip, r2, #7
46 beq 1b @ If new byte, goto old routine 49 beq 1b @ If new byte, goto old routine
47 ldrb r3, [r0, r2, lsr #3] 50 ARM( ldrb r3, [r0, r2, lsr #3] )
51 THUMB( lsr r3, r2, #3 )
52 THUMB( ldrb r3, [r0, r3] )
48 eor r3, r3, #0xff @ now looking for a 1 bit 53 eor r3, r3, #0xff @ now looking for a 1 bit
49 movs r3, r3, lsr ip @ shift off unused bits 54 movs r3, r3, lsr ip @ shift off unused bits
50 bne .L_found 55 bne .L_found
@@ -61,7 +66,10 @@ ENTRY(_find_first_bit_le)
61 teq r1, #0 66 teq r1, #0
62 beq 3f 67 beq 3f
63 mov r2, #0 68 mov r2, #0
641: ldrb r3, [r0, r2, lsr #3] 691:
70 ARM( ldrb r3, [r0, r2, lsr #3] )
71 THUMB( lsr r3, r2, #3 )
72 THUMB( ldrb r3, [r0, r3] )
65 movs r3, r3 73 movs r3, r3
66 bne .L_found @ any now set - found zero bit 74 bne .L_found @ any now set - found zero bit
67 add r2, r2, #8 @ next bit pointer 75 add r2, r2, #8 @ next bit pointer
@@ -80,7 +88,9 @@ ENTRY(_find_next_bit_le)
80 beq 3b 88 beq 3b
81 ands ip, r2, #7 89 ands ip, r2, #7
82 beq 1b @ If new byte, goto old routine 90 beq 1b @ If new byte, goto old routine
83 ldrb r3, [r0, r2, lsr #3] 91 ARM( ldrb r3, [r0, r2, lsr #3] )
92 THUMB( lsr r3, r2, #3 )
93 THUMB( ldrb r3, [r0, r3] )
84 movs r3, r3, lsr ip @ shift off unused bits 94 movs r3, r3, lsr ip @ shift off unused bits
85 bne .L_found 95 bne .L_found
86 orr r2, r2, #7 @ if zero, then no bits here 96 orr r2, r2, #7 @ if zero, then no bits here
@@ -95,7 +105,9 @@ ENTRY(_find_first_zero_bit_be)
95 beq 3f 105 beq 3f
96 mov r2, #0 106 mov r2, #0
971: eor r3, r2, #0x18 @ big endian byte ordering 1071: eor r3, r2, #0x18 @ big endian byte ordering
98 ldrb r3, [r0, r3, lsr #3] 108 ARM( ldrb r3, [r0, r3, lsr #3] )
109 THUMB( lsr r3, #3 )
110 THUMB( ldrb r3, [r0, r3] )
99 eors r3, r3, #0xff @ invert bits 111 eors r3, r3, #0xff @ invert bits
100 bne .L_found @ any now set - found zero bit 112 bne .L_found @ any now set - found zero bit
101 add r2, r2, #8 @ next bit pointer 113 add r2, r2, #8 @ next bit pointer
@@ -111,7 +123,9 @@ ENTRY(_find_next_zero_bit_be)
111 ands ip, r2, #7 123 ands ip, r2, #7
112 beq 1b @ If new byte, goto old routine 124 beq 1b @ If new byte, goto old routine
113 eor r3, r2, #0x18 @ big endian byte ordering 125 eor r3, r2, #0x18 @ big endian byte ordering
114 ldrb r3, [r0, r3, lsr #3] 126 ARM( ldrb r3, [r0, r3, lsr #3] )
127 THUMB( lsr r3, #3 )
128 THUMB( ldrb r3, [r0, r3] )
115 eor r3, r3, #0xff @ now looking for a 1 bit 129 eor r3, r3, #0xff @ now looking for a 1 bit
116 movs r3, r3, lsr ip @ shift off unused bits 130 movs r3, r3, lsr ip @ shift off unused bits
117 bne .L_found 131 bne .L_found
@@ -125,7 +139,9 @@ ENTRY(_find_first_bit_be)
125 beq 3f 139 beq 3f
126 mov r2, #0 140 mov r2, #0
1271: eor r3, r2, #0x18 @ big endian byte ordering 1411: eor r3, r2, #0x18 @ big endian byte ordering
128 ldrb r3, [r0, r3, lsr #3] 142 ARM( ldrb r3, [r0, r3, lsr #3] )
143 THUMB( lsr r3, #3 )
144 THUMB( ldrb r3, [r0, r3] )
129 movs r3, r3 145 movs r3, r3
130 bne .L_found @ any now set - found zero bit 146 bne .L_found @ any now set - found zero bit
131 add r2, r2, #8 @ next bit pointer 147 add r2, r2, #8 @ next bit pointer
@@ -141,7 +157,9 @@ ENTRY(_find_next_bit_be)
141 ands ip, r2, #7 157 ands ip, r2, #7
142 beq 1b @ If new byte, goto old routine 158 beq 1b @ If new byte, goto old routine
143 eor r3, r2, #0x18 @ big endian byte ordering 159 eor r3, r2, #0x18 @ big endian byte ordering
144 ldrb r3, [r0, r3, lsr #3] 160 ARM( ldrb r3, [r0, r3, lsr #3] )
161 THUMB( lsr r3, #3 )
162 THUMB( ldrb r3, [r0, r3] )
145 movs r3, r3, lsr ip @ shift off unused bits 163 movs r3, r3, lsr ip @ shift off unused bits
146 bne .L_found 164 bne .L_found
147 orr r2, r2, #7 @ if zero, then no bits here 165 orr r2, r2, #7 @ if zero, then no bits here
diff --git a/arch/arm/lib/getuser.S b/arch/arm/lib/getuser.S
index 6763088b7607..a1814d927122 100644
--- a/arch/arm/lib/getuser.S
+++ b/arch/arm/lib/getuser.S
@@ -36,8 +36,13 @@ ENTRY(__get_user_1)
36ENDPROC(__get_user_1) 36ENDPROC(__get_user_1)
37 37
38ENTRY(__get_user_2) 38ENTRY(__get_user_2)
39#ifdef CONFIG_THUMB2_KERNEL
402: ldrbt r2, [r0]
413: ldrbt r3, [r0, #1]
42#else
392: ldrbt r2, [r0], #1 432: ldrbt r2, [r0], #1
403: ldrbt r3, [r0] 443: ldrbt r3, [r0]
45#endif
41#ifndef __ARMEB__ 46#ifndef __ARMEB__
42 orr r2, r2, r3, lsl #8 47 orr r2, r2, r3, lsl #8
43#else 48#else
diff --git a/arch/arm/lib/io-writesw-armv4.S b/arch/arm/lib/io-writesw-armv4.S
index d6585612c86b..ff4f71b579ee 100644
--- a/arch/arm/lib/io-writesw-armv4.S
+++ b/arch/arm/lib/io-writesw-armv4.S
@@ -75,7 +75,10 @@ ENTRY(__raw_writesw)
75#endif 75#endif
76 76
77.Loutsw_noalign: 77.Loutsw_noalign:
78 ldr r3, [r1, -r3]! 78 ARM( ldr r3, [r1, -r3]! )
79 THUMB( rsb r3, r3, #0 )
80 THUMB( ldr r3, [r1, r3] )
81 THUMB( sub r1, r3 )
79 subcs r2, r2, #1 82 subcs r2, r2, #1
80 bcs 2f 83 bcs 2f
81 subs r2, r2, #2 84 subs r2, r2, #2
diff --git a/arch/arm/lib/lshrdi3.S b/arch/arm/lib/lshrdi3.S
index 99ea338bf87c..f83d449141f7 100644
--- a/arch/arm/lib/lshrdi3.S
+++ b/arch/arm/lib/lshrdi3.S
@@ -43,7 +43,9 @@ ENTRY(__aeabi_llsr)
43 rsb ip, r2, #32 43 rsb ip, r2, #32
44 movmi al, al, lsr r2 44 movmi al, al, lsr r2
45 movpl al, ah, lsr r3 45 movpl al, ah, lsr r3
46 orrmi al, al, ah, lsl ip 46 ARM( orrmi al, al, ah, lsl ip )
47 THUMB( lslmi r3, ah, ip )
48 THUMB( orrmi al, al, r3 )
47 mov ah, ah, lsr r2 49 mov ah, ah, lsr r2
48 mov pc, lr 50 mov pc, lr
49 51
diff --git a/arch/arm/lib/memcpy.S b/arch/arm/lib/memcpy.S
index e0d002641d3f..a9b9e2287a09 100644
--- a/arch/arm/lib/memcpy.S
+++ b/arch/arm/lib/memcpy.S
@@ -13,8 +13,11 @@
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <asm/assembler.h> 14#include <asm/assembler.h>
15 15
16#define LDR1W_SHIFT 0
17#define STR1W_SHIFT 0
18
16 .macro ldr1w ptr reg abort 19 .macro ldr1w ptr reg abort
17 ldr \reg, [\ptr], #4 20 W(ldr) \reg, [\ptr], #4
18 .endm 21 .endm
19 22
20 .macro ldr4w ptr reg1 reg2 reg3 reg4 abort 23 .macro ldr4w ptr reg1 reg2 reg3 reg4 abort
@@ -30,7 +33,7 @@
30 .endm 33 .endm
31 34
32 .macro str1w ptr reg abort 35 .macro str1w ptr reg abort
33 str \reg, [\ptr], #4 36 W(str) \reg, [\ptr], #4
34 .endm 37 .endm
35 38
36 .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort 39 .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
diff --git a/arch/arm/lib/memmove.S b/arch/arm/lib/memmove.S
index 12549187088c..5025c863713d 100644
--- a/arch/arm/lib/memmove.S
+++ b/arch/arm/lib/memmove.S
@@ -75,24 +75,24 @@ ENTRY(memmove)
75 addne pc, pc, ip @ C is always clear here 75 addne pc, pc, ip @ C is always clear here
76 b 7f 76 b 7f
776: nop 776: nop
78 ldr r3, [r1, #-4]! 78 W(ldr) r3, [r1, #-4]!
79 ldr r4, [r1, #-4]! 79 W(ldr) r4, [r1, #-4]!
80 ldr r5, [r1, #-4]! 80 W(ldr) r5, [r1, #-4]!
81 ldr r6, [r1, #-4]! 81 W(ldr) r6, [r1, #-4]!
82 ldr r7, [r1, #-4]! 82 W(ldr) r7, [r1, #-4]!
83 ldr r8, [r1, #-4]! 83 W(ldr) r8, [r1, #-4]!
84 ldr lr, [r1, #-4]! 84 W(ldr) lr, [r1, #-4]!
85 85
86 add pc, pc, ip 86 add pc, pc, ip
87 nop 87 nop
88 nop 88 nop
89 str r3, [r0, #-4]! 89 W(str) r3, [r0, #-4]!
90 str r4, [r0, #-4]! 90 W(str) r4, [r0, #-4]!
91 str r5, [r0, #-4]! 91 W(str) r5, [r0, #-4]!
92 str r6, [r0, #-4]! 92 W(str) r6, [r0, #-4]!
93 str r7, [r0, #-4]! 93 W(str) r7, [r0, #-4]!
94 str r8, [r0, #-4]! 94 W(str) r8, [r0, #-4]!
95 str lr, [r0, #-4]! 95 W(str) lr, [r0, #-4]!
96 96
97 CALGN( bcs 2b ) 97 CALGN( bcs 2b )
98 98
diff --git a/arch/arm/lib/putuser.S b/arch/arm/lib/putuser.S
index 864f3c1c4f18..02fedbf07c0d 100644
--- a/arch/arm/lib/putuser.S
+++ b/arch/arm/lib/putuser.S
@@ -37,6 +37,15 @@ ENDPROC(__put_user_1)
37 37
38ENTRY(__put_user_2) 38ENTRY(__put_user_2)
39 mov ip, r2, lsr #8 39 mov ip, r2, lsr #8
40#ifdef CONFIG_THUMB2_KERNEL
41#ifndef __ARMEB__
422: strbt r2, [r0]
433: strbt ip, [r0, #1]
44#else
452: strbt ip, [r0]
463: strbt r2, [r0, #1]
47#endif
48#else /* !CONFIG_THUMB2_KERNEL */
40#ifndef __ARMEB__ 49#ifndef __ARMEB__
412: strbt r2, [r0], #1 502: strbt r2, [r0], #1
423: strbt ip, [r0] 513: strbt ip, [r0]
@@ -44,6 +53,7 @@ ENTRY(__put_user_2)
442: strbt ip, [r0], #1 532: strbt ip, [r0], #1
453: strbt r2, [r0] 543: strbt r2, [r0]
46#endif 55#endif
56#endif /* CONFIG_THUMB2_KERNEL */
47 mov r0, #0 57 mov r0, #0
48 mov pc, lr 58 mov pc, lr
49ENDPROC(__put_user_2) 59ENDPROC(__put_user_2)
@@ -55,8 +65,13 @@ ENTRY(__put_user_4)
55ENDPROC(__put_user_4) 65ENDPROC(__put_user_4)
56 66
57ENTRY(__put_user_8) 67ENTRY(__put_user_8)
68#ifdef CONFIG_THUMB2_KERNEL
695: strt r2, [r0]
706: strt r3, [r0, #4]
71#else
585: strt r2, [r0], #4 725: strt r2, [r0], #4
596: strt r3, [r0] 736: strt r3, [r0]
74#endif
60 mov r0, #0 75 mov r0, #0
61 mov pc, lr 76 mov pc, lr
62ENDPROC(__put_user_8) 77ENDPROC(__put_user_8)
diff --git a/arch/arm/lib/strncpy_from_user.S b/arch/arm/lib/strncpy_from_user.S
index 330373c26dd9..1c9814f346c6 100644
--- a/arch/arm/lib/strncpy_from_user.S
+++ b/arch/arm/lib/strncpy_from_user.S
@@ -23,7 +23,7 @@
23ENTRY(__strncpy_from_user) 23ENTRY(__strncpy_from_user)
24 mov ip, r1 24 mov ip, r1
251: subs r2, r2, #1 251: subs r2, r2, #1
26USER( ldrplbt r3, [r1], #1) 26 ldrusr r3, r1, 1, pl
27 bmi 2f 27 bmi 2f
28 strb r3, [r0], #1 28 strb r3, [r0], #1
29 teq r3, #0 29 teq r3, #0
diff --git a/arch/arm/lib/strnlen_user.S b/arch/arm/lib/strnlen_user.S
index 90bb9d020836..7855b2906659 100644
--- a/arch/arm/lib/strnlen_user.S
+++ b/arch/arm/lib/strnlen_user.S
@@ -23,7 +23,7 @@
23ENTRY(__strnlen_user) 23ENTRY(__strnlen_user)
24 mov r2, r0 24 mov r2, r0
251: 251:
26USER( ldrbt r3, [r0], #1) 26 ldrusr r3, r0, 1
27 teq r3, #0 27 teq r3, #0
28 beq 2f 28 beq 2f
29 subs r1, r1, #1 29 subs r1, r1, #1