--- cpukit/score/include/rtems/score/percpu.h | 68 +++++++++++++++++++++++++++++ 1 files changed, 68 insertions(+), 0 deletions(-)
diff --git a/cpukit/score/include/rtems/score/percpu.h b/cpukit/score/include/rtems/score/percpu.h index 383202c..5331fcd 100644 --- a/cpukit/score/include/rtems/score/percpu.h +++ b/cpukit/score/include/rtems/score/percpu.h @@ -271,6 +271,72 @@ void _Per_CPU_Wait_for_state( #endif +#if defined( RTEMS_SMP ) && defined( RTEMS_DEBUG ) + +#include <rtems/score/assert.h> + +static inline Thread_Control **_Per_CPU_Get_heir( void ) +{ + _Assert_Thread_dispatching_repressed(); + + return &(_Per_CPU_Information[_SMP_Get_current_processor()].heir); +} + +static inline Thread_Control **_Per_CPU_Get_executing( void ) +{ + _Assert_Thread_dispatching_repressed(); + + return &(_Per_CPU_Information[_SMP_Get_current_processor()].executing); +} + +static inline uint32_t *_Per_CPU_Get_ISR_nest_level( void ) +{ + _Assert_Thread_dispatching_repressed(); + + return &(_Per_CPU_Information[_SMP_Get_current_processor()].isr_nest_level); +} + +#if (CPU_ALLOCATE_INTERRUPT_STACK == TRUE) || \ + (CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE) +static inline void **_Per_CPU_Get_interrupt_stack_low( void ) +{ + _Assert_Thread_dispatching_repressed(); + + return &(_Per_CPU_Information[_SMP_Get_current_processor()].interrupt_stack_low); +} + +static inline void **_Per_CPU_Get_interrupt_stack_high( void ) +{ + _Assert_Thread_dispatching_repressed(); + + return &(_Per_CPU_Information[_SMP_Get_current_processor()].interrupt_stack_high); +} +#endif + +static inline volatile bool *_Per_CPU_Get_dispatch_necessary( void ) +{ + _Assert_Thread_dispatching_repressed(); + + return &(_Per_CPU_Information[_SMP_Get_current_processor()].dispatch_necessary); +} + +static inline Timestamp_Control *_Per_CPU_Get_time_of_last_context_switch( void ) +{ + _Assert_Thread_dispatching_repressed(); + + return &(_Per_CPU_Information[_SMP_Get_current_processor()].time_of_last_context_switch); +} + +#define _Thread_Heir (*_Per_CPU_Get_heir()) +#define _Thread_Executing (*_Per_CPU_Get_executing()) +#define _ISR_Nest_level (*_Per_CPU_Get_ISR_nest_level()) +#define _CPU_Interrupt_stack_low (*_Per_CPU_Get_interrupt_stack_low()) +#define _CPU_Interrupt_stack_high (*_Per_CPU_Get_interrupt_stack_high()) +#define _Thread_Dispatch_necessary (*_Per_CPU_Get_dispatch_necessary()) +#define _Thread_Time_of_last_context_switch (*_Per_CPU_Get_time_of_last_context_switch()) + +#else /* !( defined( RTEMS_SMP ) && defined( RTEMS_DEBUG ) ) */ + /* * On a non SMP system, the _SMP_Get_current_processor() is defined to 0. * Thus when built for non-SMP, there should be no performance penalty. @@ -290,6 +356,8 @@ void _Per_CPU_Wait_for_state( #define _Thread_Time_of_last_context_switch \ _Per_CPU_Information[_SMP_Get_current_processor()].time_of_last_context_switch +#endif /* !( defined( RTEMS_SMP ) && defined( RTEMS_DEBUG ) ) */ + #endif /* ASM */ #ifdef __cplusplus -- 1.7.7 _______________________________________________ rtems-devel mailing list rtems-devel@rtems.org http://www.rtems.org/mailman/listinfo/rtems-devel