summaryrefslogtreecommitdiffstats
path: root/cpukit/score/cpu/arm/rtems/asm.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-07-01 10:48:28 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-07-04 13:17:19 +0200
commitfbda4a8834c5c88c138466fb94c4004be7d72d66 (patch)
treeda13bb222edf9c59b3923357e23fc6545c255f8a /cpukit/score/cpu/arm/rtems/asm.h
parentarm: Use local label in _CPU_Context_restore() (diff)
downloadrtems-fbda4a8834c5c88c138466fb94c4004be7d72d66.tar.bz2
score: PR2183: Fix context switch on SMP
Fix context switch on SMP for ARM, PowerPC and SPARC. Atomically test and set the is executing indicator of the heir context to ensure that at most one processor uses the heir context. Break the busy wait loop also due to heir updates.
Diffstat (limited to '')
-rw-r--r--cpukit/score/cpu/arm/rtems/asm.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/cpukit/score/cpu/arm/rtems/asm.h b/cpukit/score/cpu/arm/rtems/asm.h
index 6539a38913..d22514d60a 100644
--- a/cpukit/score/cpu/arm/rtems/asm.h
+++ b/cpukit/score/cpu/arm/rtems/asm.h
@@ -41,8 +41,7 @@
#ifndef ASM
#define ASM
#endif
-#include <rtems/score/cpuopts.h>
-#include <rtems/score/arm.h>
+#include <rtems/score/percpu.h>
/**
* @defgroup ScoreCPUARMASM ARM Assembler Support
@@ -188,6 +187,17 @@
#endif /* __thumb__ */
.endm
+.macro GET_SELF_CPU_CONTROL REG, TMP
+ ldr \REG, =_Per_CPU_Information
+#ifdef RTEMS_SMP
+ /* Use ARMv7 Multiprocessor Affinity Register (MPIDR) */
+ mrc p15, 0, \TMP, c0, c0, 5
+
+ and \TMP, \TMP, #0xff
+ add \REG, \REG, \TMP, asl #PER_CPU_CONTROL_SIZE_LOG2
+#endif
+.endm
+
/** @} */
#endif /* _RTEMS_ASM_H */