summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-11 14:12:03 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-18 07:30:34 +0100
commitf9aa34ddd9afa2953cf690eadb6119b1d24f4fc6 (patch)
tree02711ea5a21681fa2990a9959ba82ac818db9ab2
parentscore: Add Per_CPU_Control::isr_dispatch_disable (diff)
downloadrtems-f9aa34ddd9afa2953cf690eadb6119b1d24f4fc6.tar.bz2
score: Add Per_CPU_Control::Interrupt_frame
Update #2809.
-rw-r--r--cpukit/score/cpu/sparc/cpu.c5
-rw-r--r--cpukit/score/include/rtems/score/percpu.h28
-rw-r--r--cpukit/score/src/percpuasm.c14
3 files changed, 38 insertions, 9 deletions
diff --git a/cpukit/score/cpu/sparc/cpu.c b/cpukit/score/cpu/sparc/cpu.c
index 92d1c66d45..4aa30dbaef 100644
--- a/cpukit/score/cpu/sparc/cpu.c
+++ b/cpukit/score/cpu/sparc/cpu.c
@@ -110,11 +110,6 @@ RTEMS_STATIC_ASSERT(
SPARC_MINIMUM_STACK_FRAME_SIZE
);
-RTEMS_STATIC_ASSERT(
- sizeof(CPU_Interrupt_frame) == CPU_INTERRUPT_FRAME_SIZE,
- CPU_Interrupt_frame_size
-);
-
/* https://devel.rtems.org/ticket/2352 */
RTEMS_STATIC_ASSERT(
sizeof(CPU_Interrupt_frame) % CPU_ALIGNMENT == 0,
diff --git a/cpukit/score/include/rtems/score/percpu.h b/cpukit/score/include/rtems/score/percpu.h
index d2025c0ccf..39190e9ef9 100644
--- a/cpukit/score/include/rtems/score/percpu.h
+++ b/cpukit/score/include/rtems/score/percpu.h
@@ -9,6 +9,8 @@
* COPYRIGHT (c) 1989-2011.
* On-Line Applications Research Corporation (OAR).
*
+ * Copyright (c) 2012, 2016 embedded brains GmbH
+ *
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
@@ -35,16 +37,28 @@
extern "C" {
#endif
-#if defined( RTEMS_SMP )
+#if defined(RTEMS_SMP)
+ #if defined(RTEMS_PROFILING)
+ #define PER_CPU_CONTROL_SIZE_APPROX ( 512 + CPU_INTERRUPT_FRAME_SIZE )
+ #elif defined(RTEMS_DEBUG)
+ #define PER_CPU_CONTROL_SIZE_APPROX ( 256 + CPU_INTERRUPT_FRAME_SIZE )
+ #else
+ #define PER_CPU_CONTROL_SIZE_APPROX ( 128 + CPU_INTERRUPT_FRAME_SIZE )
+ #endif
+
/*
* This ensures that on SMP configurations the individual per-CPU controls
* are on different cache lines to prevent false sharing. This define can be
* used in assembler code to easily get the per-CPU control for a particular
* processor.
*/
- #if defined( RTEMS_PROFILING )
+ #if PER_CPU_CONTROL_SIZE_APPROX > 1024
+ #define PER_CPU_CONTROL_SIZE_LOG2 11
+ #elif PER_CPU_CONTROL_SIZE_APPROX > 512
+ #define PER_CPU_CONTROL_SIZE_LOG2 10
+ #elif PER_CPU_CONTROL_SIZE_APPROX > 256
#define PER_CPU_CONTROL_SIZE_LOG2 9
- #elif defined( RTEMS_DEBUG )
+ #elif PER_CPU_CONTROL_SIZE_APPROX > 128
#define PER_CPU_CONTROL_SIZE_LOG2 8
#else
#define PER_CPU_CONTROL_SIZE_LOG2 7
@@ -348,6 +362,10 @@ typedef struct Per_CPU_Control {
*/
volatile bool dispatch_necessary;
+#if defined(RTEMS_SMP)
+ CPU_Interrupt_frame Interrupt_frame;
+#endif
+
/**
* @brief The CPU usage timestamp contains the time point of the last heir
* thread change or last CPU usage update of the executing thread of this
@@ -800,6 +818,10 @@ RTEMS_INLINE_ROUTINE struct _Thread_Control *_Thread_Get_executing( void )
PER_CPU_OFFSET_EXECUTING + CPU_SIZEOF_POINTER
#define PER_CPU_DISPATCH_NEEDED \
PER_CPU_OFFSET_HEIR + CPU_SIZEOF_POINTER
+#if defined(RTEMS_SMP)
+#define PER_CPU_INTERRUPT_FRAME_AREA \
+ PER_CPU_DISPATCH_NEEDED + 4
+#endif
#define THREAD_DISPATCH_DISABLE_LEVEL \
(SYM(_Per_CPU_Information) + PER_CPU_THREAD_DISPATCH_DISABLE_LEVEL)
diff --git a/cpukit/score/src/percpuasm.c b/cpukit/score/src/percpuasm.c
index 29bdb138e7..2908643f6c 100644
--- a/cpukit/score/src/percpuasm.c
+++ b/cpukit/score/src/percpuasm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2014 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2012, 2016 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Dornierstr. 4
@@ -110,6 +110,18 @@ RTEMS_STATIC_ASSERT(
PER_CPU_DISPATCH_NEEDED
);
+#if defined(RTEMS_SMP)
+RTEMS_STATIC_ASSERT(
+ offsetof(Per_CPU_Control, Interrupt_frame) == PER_CPU_INTERRUPT_FRAME_AREA,
+ PER_CPU_INTERRUPT_FRAME_AREA
+);
+
+RTEMS_STATIC_ASSERT(
+ sizeof( CPU_Interrupt_frame ) == CPU_INTERRUPT_FRAME_SIZE,
+ CPU_INTERRUPT_FRAME_SIZE
+);
+#endif
+
#if CPU_ALLOCATE_INTERRUPT_STACK == TRUE \
|| CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE
RTEMS_STATIC_ASSERT(