summaryrefslogtreecommitdiffstats
path: root/schedsim/rtems/sched_cpu/rtems/score/cpu.h
diff options
context:
space:
mode:
authorJennifer Averett <jennifer.averett@oarcorp.com>2014-05-09 11:10:05 -0500
committerJennifer Averett <jennifer.averett@oarcorp.com>2014-05-09 11:10:05 -0500
commit35047a179004f6d84002d4b90563656206c36063 (patch)
tree74d5728a82efa85ebb6e1a8f865c9e624988054f /schedsim/rtems/sched_cpu/rtems/score/cpu.h
parentschedsim_smpsimple: Fix compile error. (diff)
downloadrtems-schedsim-35047a179004f6d84002d4b90563656206c36063.tar.bz2
sched_cpu: add is_executing to context.
Diffstat (limited to 'schedsim/rtems/sched_cpu/rtems/score/cpu.h')
-rw-r--r--schedsim/rtems/sched_cpu/rtems/score/cpu.h44
1 files changed, 38 insertions, 6 deletions
diff --git a/schedsim/rtems/sched_cpu/rtems/score/cpu.h b/schedsim/rtems/sched_cpu/rtems/score/cpu.h
index 03817fc..7c1703f 100644
--- a/schedsim/rtems/sched_cpu/rtems/score/cpu.h
+++ b/schedsim/rtems/sched_cpu/rtems/score/cpu.h
@@ -472,19 +472,34 @@ typedef struct {
* to another.
*/
typedef struct {
- /** This field is a hint that a port will have a number of integer
- * registers that need to be saved at a context switch.
+ /**
+ * This field is a hint that a port will have a number of integer
+ * registers that need to be saved at a context switch.
*/
uint32_t some_integer_register;
- /** This field is a hint that a port will have a number of system
- * registers that need to be saved at a context switch.
+ /**
+ * This field is a hint that a port will have a number of system
+ * registers that need to be saved at a context switch.
*/
uint32_t some_system_register;
- /** This field is a hint that a port will have a register that
- * is the stack pointer.
+ /**
+ * This field is a hint that a port will have a register that
+ * is the stack pointer.
*/
uint32_t stack_pointer;
+
+#ifdef RTEMS_SMP
+ /**
+ * @brief On SMP configurations the thread context must contain a boolean
+ * indicator if this context is executing on a processor.
+ *
+ * This field must be updated during a context switch. The context switch
+ * to the heir must wait until the heir context indicates that it is no
+ * longer executing on a processor.
+ */
+ volatile bool is_executing;
+#endif
} Context_Control;
/**
@@ -499,6 +514,23 @@ typedef struct {
#define _CPU_Context_Get_SP( _context ) \
(_context)->stack_pointer
+#ifdef RTEMS_SMP
+ static inline bool _CPU_Context_Get_is_executing(
+ const Context_Control *context
+ )
+ {
+ return context->is_executing;
+ }
+
+ static inline void _CPU_Context_Set_is_executing(
+ Context_Control *context,
+ bool is_executing
+ )
+ {
+ context->is_executing = is_executing;
+ }
+#endif
+
/**
* @ingroup CPUContext Management
* This defines the complete set of floating point registers that must