[PATCH 17/26] score: Add Per_CPU_Control::Interrupt_frame
Sebastian Huber
sebastian.huber at embedded-brains.de
Tue Nov 15 13:51:49 UTC 2016
Update #2809.
---
cpukit/score/cpu/sparc/cpu.c | 5 -----
cpukit/score/include/rtems/score/percpu.h | 28 +++++++++++++++++++++++++---
cpukit/score/src/percpuasm.c | 14 +++++++++++++-
3 files changed, 38 insertions(+), 9 deletions(-)
diff --git a/cpukit/score/cpu/sparc/cpu.c b/cpukit/score/cpu/sparc/cpu.c
index 92d1c66..4aa30db 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 d2025c0..39190e9 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 29bdb13..2908643 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(
--
1.8.4.5
More information about the devel
mailing list