aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/include
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/arm/include
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/arm/include')
-rw-r--r--arch/arm/include/asm/assembler.h73
-rw-r--r--arch/arm/include/asm/uaccess.h7
2 files changed, 78 insertions, 2 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" \