summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-13 15:18:58 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-18 07:30:31 +0100
commit04bd2617269880afaafa8f0647aaeda50b50698c (patch)
tree6557663e60ceafbd1c36b82598e0e382efaf4217 /c
parentFix untar mkdir when the directory exists. (diff)
downloadrtems-04bd2617269880afaafa8f0647aaeda50b50698c.tar.bz2
arm: Use TPIDRPRW for current per-CPU control
Use the previously unused TPIDRPRW register to get the per-CPU control of the current processor. This avoids instructions in GET_SELF_CPU_CONTROL which are not available in Thumb mode.
Diffstat (limited to 'c')
-rw-r--r--c/src/lib/libbsp/arm/shared/start/start.S18
1 files changed, 13 insertions, 5 deletions
diff --git a/c/src/lib/libbsp/arm/shared/start/start.S b/c/src/lib/libbsp/arm/shared/start/start.S
index cb66d82483..7adcb443c2 100644
--- a/c/src/lib/libbsp/arm/shared/start/start.S
+++ b/c/src/lib/libbsp/arm/shared/start/start.S
@@ -5,10 +5,10 @@
*/
/*
- * Copyright (c) 2008-2014 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2008, 2016 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
- * Obere Lagerstr. 30
+ * Dornierstr. 4
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
@@ -20,7 +20,7 @@
#include <rtems/asm.h>
#include <rtems/system.h>
-#include <rtems/score/cpu.h>
+#include <rtems/score/percpu.h>
#include <bspopts.h>
#include <bsp/irq.h>
@@ -184,11 +184,19 @@ _start:
#endif
#ifdef RTEMS_SMP
- /* Read MPIDR */
+ /* Read MPIDR and get current processor index */
mrc p15, 0, r0, c0, c0, 5
+ and r0, #0xff
+
+ /*
+ * Get current per-CPU control and store it in PL1 only Thread ID
+ * Register (TPIDRPRW).
+ */
+ ldr r1, =_Per_CPU_Information
+ add r1, r1, r0, asl #PER_CPU_CONTROL_SIZE_LOG2
+ mcr p15, 0, r1, c13, c0, 4
/* Calculate stack offset */
- and r0, #0xff
ldr r1, =bsp_stack_all_size
mul r1, r0
#endif