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.
This commit is contained in:
Sebastian Huber
2014-05-08 10:11:13 +02:00
parent 35a3af7af8
commit 11b05f11d4
14 changed files with 132 additions and 61 deletions

View File

@@ -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();