diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-11-04 13:19:11 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-11-07 07:39:41 +0100 |
commit | edbd43c6132ddb0644bd302c6017b52168e57857 (patch) | |
tree | 7b2e743bc285a57ccfae259bda9de42f21d4dc51 | |
parent | score: Add <rtems/score/cpuimpl.h> (diff) | |
download | rtems-edbd43c6132ddb0644bd302c6017b52168e57857.tar.bz2 |
score: Prevent assignment to _Thread_Executing
-rw-r--r-- | cpukit/score/include/rtems/score/percpu.h | 2 | ||||
-rw-r--r-- | testsuites/tmtests/tm26/task1.c | 12 | ||||
-rw-r--r-- | testsuites/tmtests/tm27/task1.c | 15 |
3 files changed, 13 insertions, 16 deletions
diff --git a/cpukit/score/include/rtems/score/percpu.h b/cpukit/score/include/rtems/score/percpu.h index 3e0c348005..236cf6a979 100644 --- a/cpukit/score/include/rtems/score/percpu.h +++ b/cpukit/score/include/rtems/score/percpu.h @@ -682,7 +682,7 @@ bool _Per_CPU_State_wait_for_non_initial_state( #define _Thread_Heir \ _Per_CPU_Get()->heir #define _Thread_Executing \ - _Per_CPU_Get()->executing + _Per_CPU_Get_executing( _Per_CPU_Get() ) #define _ISR_Nest_level \ _Per_CPU_Get()->isr_nest_level #define _CPU_Interrupt_stack_low \ diff --git a/testsuites/tmtests/tm26/task1.c b/testsuites/tmtests/tm26/task1.c index 173cf7f2c2..9d157e9fcf 100644 --- a/testsuites/tmtests/tm26/task1.c +++ b/testsuites/tmtests/tm26/task1.c @@ -123,17 +123,7 @@ static void set_thread_heir( Thread_Control *thread ) static void set_thread_executing( Thread_Control *thread ) { -#if defined( PREVENT_SMP_ASSERT_FAILURES ) - ISR_Level level; - - _ISR_Local_disable( level ); -#endif - - _Thread_Executing = thread; - -#if defined( PREVENT_SMP_ASSERT_FAILURES ) - _ISR_Local_enable( level ); -#endif + _Per_CPU_Get_snapshot()->executing = thread; } static void thread_resume( Thread_Control *thread ) diff --git a/testsuites/tmtests/tm27/task1.c b/testsuites/tmtests/tm27/task1.c index 9126391d59..c89c0956f1 100644 --- a/testsuites/tmtests/tm27/task1.c +++ b/testsuites/tmtests/tm27/task1.c @@ -46,6 +46,11 @@ rtems_isr Isr_handler( rtems_vector_number vector ); +static void set_thread_executing( Thread_Control *thread ) +{ + _Per_CPU_Get_snapshot()->executing = thread; +} + rtems_task Init( rtems_task_argument argument ) @@ -191,8 +196,9 @@ rtems_task Task_1( _ISR_Local_disable(level); #endif - _Thread_Executing = - (Thread_Control *) _Chain_First(&scheduler_context->Ready[LOW_PRIORITY]); + set_thread_executing( + (Thread_Control *) _Chain_First(&scheduler_context->Ready[LOW_PRIORITY]) + ); _Thread_Dispatch_necessary = 1; @@ -265,8 +271,9 @@ rtems_task Task_2( _Thread_State_acquire( executing, &state_lock_context ); _Scheduler_Acquire_critical( scheduler, &scheduler_lock_context ); - _Thread_Executing = - (Thread_Control *) _Chain_First(&scheduler_context->Ready[LOW_PRIORITY]); + set_thread_executing( + (Thread_Control *) _Chain_First(&scheduler_context->Ready[LOW_PRIORITY]) + ); _Thread_Dispatch_necessary = 1; |