summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-06-30 12:55:50 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-07-01 17:02:41 +0200
commitbec47309011551f6b18fc6f4de2558cfaa6b796e (patch)
tree3c7177fdee28489993dd643d32c15ace48fd0430
parentbsp/altera-cyclone-v: Move MMU configuration table (diff)
downloadrtems-bec47309011551f6b18fc6f4de2558cfaa6b796e.tar.bz2
score: Add PER_CPU_OFFSET_EXECUTING
Add PER_CPU_OFFSET_HEIR. Move Per_CPU_Control::executing and Per_CPU_Control::heir for easy offset calculation.
-rw-r--r--cpukit/score/include/rtems/score/percpu.h38
-rw-r--r--cpukit/score/src/percpuasm.c10
2 files changed, 31 insertions, 17 deletions
diff --git a/cpukit/score/include/rtems/score/percpu.h b/cpukit/score/include/rtems/score/percpu.h
index 30d61d519f..4be4de6974 100644
--- a/cpukit/score/include/rtems/score/percpu.h
+++ b/cpukit/score/include/rtems/score/percpu.h
@@ -271,22 +271,6 @@ typedef struct Per_CPU_Control {
volatile uint32_t thread_dispatch_disable_level;
/**
- * @brief This is set to true when this processor needs to run the
- * dispatcher.
- *
- * It is volatile since interrupts may alter this flag.
- *
- * This field is not protected by a lock. There are two writers after
- * multitasking start. The scheduler owning this processor sets this
- * indicator to true, after it updated the heir field. This processor sets
- * this indicator to false, before it reads the heir. This field is used in
- * combination with the heir field.
- *
- * @see _Thread_Get_heir_and_make_it_executing().
- */
- volatile bool dispatch_necessary;
-
- /**
* @brief This is the thread executing on this processor.
*
* This field is not protected by a lock. The only writer is this processor.
@@ -312,6 +296,22 @@ typedef struct Per_CPU_Control {
*/
Thread_Control *heir;
+ /**
+ * @brief This is set to true when this processor needs to run the
+ * dispatcher.
+ *
+ * It is volatile since interrupts may alter this flag.
+ *
+ * This field is not protected by a lock. There are two writers after
+ * multitasking start. The scheduler owning this processor sets this
+ * indicator to true, after it updated the heir field. This processor sets
+ * this indicator to false, before it reads the heir. This field is used in
+ * combination with the heir field.
+ *
+ * @see _Thread_Get_heir_and_make_it_executing().
+ */
+ volatile bool dispatch_necessary;
+
/** This is the time of the last context switch on this CPU. */
Timestamp_Control time_of_last_context_switch;
@@ -634,8 +634,12 @@ bool _Per_CPU_State_wait_for_non_initial_state(
PER_CPU_END_STACK
#define PER_CPU_THREAD_DISPATCH_DISABLE_LEVEL \
PER_CPU_ISR_NEST_LEVEL + 4
-#define PER_CPU_DISPATCH_NEEDED \
+#define PER_CPU_OFFSET_EXECUTING \
PER_CPU_THREAD_DISPATCH_DISABLE_LEVEL + 4
+#define PER_CPU_OFFSET_HEIR \
+ PER_CPU_OFFSET_EXECUTING + CPU_SIZEOF_POINTER
+#define PER_CPU_DISPATCH_NEEDED \
+ PER_CPU_OFFSET_HEIR + CPU_SIZEOF_POINTER
#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 d422a0deb6..15b49c72e1 100644
--- a/cpukit/score/src/percpuasm.c
+++ b/cpukit/score/src/percpuasm.c
@@ -88,6 +88,16 @@ RTEMS_STATIC_ASSERT(
);
RTEMS_STATIC_ASSERT(
+ offsetof(Per_CPU_Control, executing) == PER_CPU_OFFSET_EXECUTING,
+ PER_CPU_OFFSET_EXECUTING
+);
+
+RTEMS_STATIC_ASSERT(
+ offsetof(Per_CPU_Control, heir) == PER_CPU_OFFSET_HEIR,
+ PER_CPU_OFFSET_HEIR
+);
+
+RTEMS_STATIC_ASSERT(
offsetof(Per_CPU_Control, dispatch_necessary) == PER_CPU_DISPATCH_NEEDED,
PER_CPU_DISPATCH_NEEDED
);