summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/spcontext01/init.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-05-08 10:11:13 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-05-08 13:02:40 +0200
commit11b05f11d4d6d61717e345d20f492977b95ab131 (patch)
tree5f5bd2a21ea205ea0700d44718de7fcac8234fe7 /testsuites/sptests/spcontext01/init.c
parentdoc: Use @dfn for glossary terms (diff)
downloadrtems-11b05f11d4d6d61717e345d20f492977b95ab131.tar.bz2
score: Fix CPU context usage on SMP
We must not alter the is executing indicator in _CPU_Context_Initialize() since this would cause an invalid state during a self restart. The is executing indicator must be valid at creation time since otherwise _Thread_Kill_zombies() uses an undefined value for not started threads. This could result in a system life lock.
Diffstat (limited to 'testsuites/sptests/spcontext01/init.c')
-rw-r--r--testsuites/sptests/spcontext01/init.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/testsuites/sptests/spcontext01/init.c b/testsuites/sptests/spcontext01/init.c
index f26bc55168..e1af302c7a 100644
--- a/testsuites/sptests/spcontext01/init.c
+++ b/testsuites/sptests/spcontext01/init.c
@@ -160,12 +160,39 @@ static void test(test_context *self)
wait_for_finish();
}
+static void test_context_is_executing(void)
+{
+#if defined(RTEMS_SMP)
+ Context_Control context;
+ bool is_executing;
+
+ memset(&context, 0, sizeof(context));
+
+ is_executing = _CPU_Context_Get_is_executing(&context);
+ rtems_test_assert(!is_executing);
+
+ _CPU_Context_Set_is_executing(&context, true);
+ is_executing = _CPU_Context_Get_is_executing(&context);
+ rtems_test_assert(is_executing);
+
+ _CPU_Context_Set_is_executing(&context, false);
+ is_executing = _CPU_Context_Get_is_executing(&context);
+ rtems_test_assert(!is_executing);
+
+ _CPU_Context_Set_is_executing(&context, true);
+ _CPU_Context_Initialize(&context, NULL, 0, 0, NULL, false, NULL);
+ is_executing = _CPU_Context_Get_is_executing(&context);
+ rtems_test_assert(is_executing);
+#endif
+}
+
static void Init(rtems_task_argument arg)
{
test_context *self = &test_instance;
TEST_BEGIN();
+ test_context_is_executing();
test(self);
TEST_END();