From e3be6915989d79a8797b775974f501a359226319 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 27 May 2013 17:31:46 +0200 Subject: score: Remove idle field of Per_CPU_Control This field is unused except for special case simulator clock drivers. In these places use an alternative. Add and use _Thread_Set_global_exit_status() and _Thread_Get_global_exit_status(). --- cpukit/sapi/src/exinit.c | 4 ++-- cpukit/sapi/src/exshutdown.c | 3 +-- cpukit/score/include/rtems/score/percpu.h | 5 ----- cpukit/score/inline/rtems/score/thread.inl | 18 ++++++++++++++++++ cpukit/score/src/threadcreateidle.c | 11 ++++++----- 5 files changed, 27 insertions(+), 14 deletions(-) (limited to 'cpukit') diff --git a/cpukit/sapi/src/exinit.c b/cpukit/sapi/src/exinit.c index 4ee24710b3..5d1419cdb2 100644 --- a/cpukit/sapi/src/exinit.c +++ b/cpukit/sapi/src/exinit.c @@ -237,7 +237,7 @@ void rtems_initialize_start_multitasking(void) ******************************************************************* ******************************************************************* *******************************************************************/ - - status = _Per_CPU_Information[0].idle->Wait.return_code; + + status = _Thread_Get_global_exit_status(); rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status ); } diff --git a/cpukit/sapi/src/exshutdown.c b/cpukit/sapi/src/exshutdown.c index 2b99995825..a54b1e6e86 100644 --- a/cpukit/sapi/src/exshutdown.c +++ b/cpukit/sapi/src/exshutdown.c @@ -44,8 +44,7 @@ void rtems_shutdown_executive( _SMP_Request_other_cores_to_shutdown(); #endif - _Per_CPU_Information[0].idle->Wait.return_code = result; - + _Thread_Set_global_exit_status( result ); _System_state_Set( SYSTEM_STATE_SHUTDOWN ); _Thread_Stop_multitasking(); diff --git a/cpukit/score/include/rtems/score/percpu.h b/cpukit/score/include/rtems/score/percpu.h index 735b422c54..f545310e1c 100644 --- a/cpukit/score/include/rtems/score/percpu.h +++ b/cpukit/score/include/rtems/score/percpu.h @@ -162,9 +162,6 @@ typedef struct { /** This is the heir thread for this this CPU. */ Thread_Control *heir; - /** This is the idle thread for this CPU. */ - Thread_Control *idle; - /** This is the time of the last context switch on this CPU. */ Timestamp_Control time_of_last_context_switch; @@ -283,8 +280,6 @@ void _Per_CPU_Wait_for_state( _Per_CPU_Information[bsp_smp_processor_id()].heir #define _Thread_Executing \ _Per_CPU_Information[bsp_smp_processor_id()].executing -#define _Thread_Idle \ - _Per_CPU_Information[bsp_smp_processor_id()].idle #define _ISR_Nest_level \ _Per_CPU_Information[bsp_smp_processor_id()].isr_nest_level #define _CPU_Interrupt_stack_low \ diff --git a/cpukit/score/inline/rtems/score/thread.inl b/cpukit/score/inline/rtems/score/thread.inl index 681cfcc3df..a42da1d5b8 100644 --- a/cpukit/score/inline/rtems/score/thread.inl +++ b/cpukit/score/inline/rtems/score/thread.inl @@ -344,6 +344,24 @@ RTEMS_INLINE_ROUTINE void _Thread_Internal_free ( _Objects_Free( &_Thread_Internal_information, &the_task->Object ); } +RTEMS_INLINE_ROUTINE void _Thread_Set_global_exit_status( + uint32_t exit_status +) +{ + Thread_Control *idle = (Thread_Control *) + _Thread_Internal_information.local_table[ 1 ]; + + idle->Wait.return_code = exit_status; +} + +RTEMS_INLINE_ROUTINE uint32_t _Thread_Get_global_exit_status( void ) +{ + const Thread_Control *idle = (const Thread_Control *) + _Thread_Internal_information.local_table[ 1 ]; + + return idle->Wait.return_code; +} + /** * This routine returns the C library re-enterant pointer. */ diff --git a/cpukit/score/src/threadcreateidle.c b/cpukit/score/src/threadcreateidle.c index a0279dec49..cc4282eed3 100644 --- a/cpukit/score/src/threadcreateidle.c +++ b/cpukit/score/src/threadcreateidle.c @@ -40,9 +40,11 @@ static inline void _Thread_Create_idle_helper( int cpu ) { - Objects_Name name; - Thread_Control *idle; + Per_CPU_Control *per_cpu; + Objects_Name name; + Thread_Control *idle; + per_cpu = &_Per_CPU_Information[ cpu ]; name.name_u32 = name_u32; /* @@ -79,9 +81,8 @@ static inline void _Thread_Create_idle_helper( * WARNING!!! This is necessary to "kick" start the system and * MUST be done before _Thread_Start is invoked. */ - _Per_CPU_Information[ cpu ].idle = - _Per_CPU_Information[ cpu ].heir = - _Per_CPU_Information[ cpu ].executing = idle; + per_cpu->heir = + per_cpu->executing = idle; _Thread_Start( idle, -- cgit v1.2.3