aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/include/asm/assembler.h
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /arch/arm/include/asm/assembler.h
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'arch/arm/include/asm/assembler.h')
-rw-r--r--arch/arm/include/asm/assembler.h64
1 files changed, 54 insertions, 10 deletions
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index 6e8f05c8a1c8..65c3f2474f5e 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -13,11 +13,15 @@
13 * Do not include any C declarations in this file - it is included by 13 * Do not include any C declarations in this file - it is included by
14 * assembler source. 14 * assembler source.
15 */ 15 */
16#ifndef __ASM_ASSEMBLER_H__
17#define __ASM_ASSEMBLER_H__
18
16#ifndef __ASSEMBLY__ 19#ifndef __ASSEMBLY__
17#error "Only include this from assembly code" 20#error "Only include this from assembly code"
18#endif 21#endif
19 22
20#include <asm/ptrace.h> 23#include <asm/ptrace.h>
24#include <asm/domain.h>
21 25
22/* 26/*
23 * Endian independent macros for shifting bytes within registers. 27 * Endian independent macros for shifting bytes within registers.
@@ -154,16 +158,55 @@
154 .long 9999b,9001f; \ 158 .long 9999b,9001f; \
155 .popsection 159 .popsection
156 160
161#ifdef CONFIG_SMP
162#define ALT_SMP(instr...) \
1639998: instr
164/*
165 * Note: if you get assembler errors from ALT_UP() when building with
166 * CONFIG_THUMB2_KERNEL, you almost certainly need to use
167 * ALT_SMP( W(instr) ... )
168 */
169#define ALT_UP(instr...) \
170 .pushsection ".alt.smp.init", "a" ;\
171 .long 9998b ;\
1729997: instr ;\
173 .if . - 9997b != 4 ;\
174 .error "ALT_UP() content must assemble to exactly 4 bytes";\
175 .endif ;\
176 .popsection
177#define ALT_UP_B(label) \
178 .equ up_b_offset, label - 9998b ;\
179 .pushsection ".alt.smp.init", "a" ;\
180 .long 9998b ;\
181 W(b) . + up_b_offset ;\
182 .popsection
183#else
184#define ALT_SMP(instr...)
185#define ALT_UP(instr...) instr
186#define ALT_UP_B(label) b label
187#endif
188
157/* 189/*
158 * SMP data memory barrier 190 * SMP data memory barrier
159 */ 191 */
160 .macro smp_dmb 192 .macro smp_dmb mode
161#ifdef CONFIG_SMP 193#ifdef CONFIG_SMP
162#if __LINUX_ARM_ARCH__ >= 7 194#if __LINUX_ARM_ARCH__ >= 7
163 dmb 195 .ifeqs "\mode","arm"
196 ALT_SMP(dmb)
197 .else
198 ALT_SMP(W(dmb))
199 .endif
164#elif __LINUX_ARM_ARCH__ == 6 200#elif __LINUX_ARM_ARCH__ == 6
165 mcr p15, 0, r0, c7, c10, 5 @ dmb 201 ALT_SMP(mcr p15, 0, r0, c7, c10, 5) @ dmb
202#else
203#error Incompatible SMP platform
166#endif 204#endif
205 .ifeqs "\mode","arm"
206 ALT_UP(nop)
207 .else
208 ALT_UP(W(nop))
209 .endif
167#endif 210#endif
168 .endm 211 .endm
169 212
@@ -183,12 +226,12 @@
183 */ 226 */
184#ifdef CONFIG_THUMB2_KERNEL 227#ifdef CONFIG_THUMB2_KERNEL
185 228
186 .macro usraccoff, instr, reg, ptr, inc, off, cond, abort 229 .macro usraccoff, instr, reg, ptr, inc, off, cond, abort, t=T()
1879999: 2309999:
188 .if \inc == 1 231 .if \inc == 1
189 \instr\cond\()bt \reg, [\ptr, #\off] 232 \instr\cond\()b\()\t\().w \reg, [\ptr, #\off]
190 .elseif \inc == 4 233 .elseif \inc == 4
191 \instr\cond\()t \reg, [\ptr, #\off] 234 \instr\cond\()\t\().w \reg, [\ptr, #\off]
192 .else 235 .else
193 .error "Unsupported inc macro argument" 236 .error "Unsupported inc macro argument"
194 .endif 237 .endif
@@ -215,7 +258,7 @@
215 @ Slightly optimised to avoid incrementing the pointer twice 258 @ Slightly optimised to avoid incrementing the pointer twice
216 usraccoff \instr, \reg, \ptr, \inc, 0, \cond, \abort 259 usraccoff \instr, \reg, \ptr, \inc, 0, \cond, \abort
217 .if \rept == 2 260 .if \rept == 2
218 usraccoff \instr, \reg, \ptr, \inc, 4, \cond, \abort 261 usraccoff \instr, \reg, \ptr, \inc, \inc, \cond, \abort
219 .endif 262 .endif
220 263
221 add\cond \ptr, #\rept * \inc 264 add\cond \ptr, #\rept * \inc
@@ -223,13 +266,13 @@
223 266
224#else /* !CONFIG_THUMB2_KERNEL */ 267#else /* !CONFIG_THUMB2_KERNEL */
225 268
226 .macro usracc, instr, reg, ptr, inc, cond, rept, abort 269 .macro usracc, instr, reg, ptr, inc, cond, rept, abort, t=T()
227 .rept \rept 270 .rept \rept
2289999: 2719999:
229 .if \inc == 1 272 .if \inc == 1
230 \instr\cond\()bt \reg, [\ptr], #\inc 273 \instr\cond\()b\()\t \reg, [\ptr], #\inc
231 .elseif \inc == 4 274 .elseif \inc == 4
232 \instr\cond\()t \reg, [\ptr], #\inc 275 \instr\cond\()\t \reg, [\ptr], #\inc
233 .else 276 .else
234 .error "Unsupported inc macro argument" 277 .error "Unsupported inc macro argument"
235 .endif 278 .endif
@@ -250,3 +293,4 @@
250 .macro ldrusr, reg, ptr, inc, cond=al, rept=1, abort=9001f 293 .macro ldrusr, reg, ptr, inc, cond=al, rept=1, abort=9001f
251 usracc ldr, \reg, \ptr, \inc, \cond, \rept, \abort 294 usracc ldr, \reg, \ptr, \inc, \cond, \rept, \abort
252 .endm 295 .endm
296#endif /* __ASM_ASSEMBLER_H__ */