aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/include/asm/assembler.h
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/asm/assembler.h
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/asm/assembler.h')
-rw-r--r--arch/arm/include/asm/assembler.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index 1acd1da36d0..2b60c7d0577 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