score: Add and use Thread_Control::is_idle

Update #2797.
This commit is contained in:
Sebastian Huber
2016-11-07 16:54:40 +01:00
parent e6107854b2
commit 1f5bee3d85
7 changed files with 8 additions and 22 deletions

View File

@@ -139,9 +139,7 @@ rtems_isr Clock_isr(
if (!rtems_configuration_is_smp_enabled()) { if (!rtems_configuration_is_smp_enabled()) {
while ( while (
_Thread_Heir == _Thread_Executing _Thread_Heir == _Thread_Executing && _Thread_Executing->is_idle
&& _Thread_Executing->Start.Entry.Kinds.Idle.entry
== rtems_configuration_get_idle_task()
) { ) {
ISR_lock_Context lock_context; ISR_lock_Context lock_context;

View File

@@ -132,8 +132,7 @@ void Clock_isr(void *arg_unused)
#ifdef CLOCK_DRIVER_USE_FAST_IDLE #ifdef CLOCK_DRIVER_USE_FAST_IDLE
do { do {
tlib_tc_tick(); tlib_tc_tick();
} while ( _Thread_Executing == _Thread_Idle && } while ( _Thread_Heir == _Thread_Executing && _Thread_Executing->is_idle );
_Thread_Heir == _Thread_Executing);
return; return;

View File

@@ -37,11 +37,7 @@ static rtems_isr clockISR(rtems_vector_number vector) {
#if CLOCK_DRIVER_USE_FAST_IDLE #if CLOCK_DRIVER_USE_FAST_IDLE
do { do {
rtems_clock_tick(); rtems_clock_tick();
} while ( } while ( _Thread_Heir == _Thread_Executing && _Thread_Executing->is_idle );
_Thread_Heir == _Thread_Executing
&& _Thread_Executing->Start.Entry.Kinds.Idle.entry
== rtems_configuration_get_idle_task()
);
#else #else
rtems_clock_tick(); rtems_clock_tick();
#endif #endif

View File

@@ -105,11 +105,7 @@ static void clockHandler(void)
tb = ppc_time_base(); tb = ppc_time_base();
rtems_timecounter_tick(); rtems_timecounter_tick();
while ( while ( _Thread_Heir == _Thread_Executing && _Thread_Executing->is_idle ) {
_Thread_Heir == _Thread_Executing
&& _Thread_Executing->Start.Entry.Kinds.Idle.entry
== rtems_configuration_get_idle_task()
) {
tb += Clock_Decrementer_value; tb += Clock_Decrementer_value;
ppc_set_time_base( tb ); ppc_set_time_base( tb );
rtems_timecounter_tick(); rtems_timecounter_tick();

View File

@@ -754,6 +754,8 @@ struct _Thread_Control {
SMP_lock_Stats Potpourri_stats; SMP_lock_Stats Potpourri_stats;
#endif #endif
/** This field is true if the thread is an idle thread. */
bool is_idle;
#if defined(RTEMS_MULTIPROCESSING) #if defined(RTEMS_MULTIPROCESSING)
/** This field is true if the thread is offered globally */ /** This field is true if the thread is offered globally */
bool is_global; bool is_global;

View File

@@ -72,6 +72,7 @@ static void _Thread_Create_idle_for_CPU( Per_CPU_Control *cpu )
cpu->heir = cpu->heir =
cpu->executing = idle; cpu->executing = idle;
idle->is_idle = true;
idle->Start.Entry.adaptor = _Thread_Entry_adaptor_idle; idle->Start.Entry.adaptor = _Thread_Entry_adaptor_idle;
idle->Start.Entry.Kinds.Idle.entry = rtems_configuration_get_idle_task(); idle->Start.Entry.Kinds.Idle.entry = rtems_configuration_get_idle_task();

View File

@@ -173,18 +173,12 @@ bool interrupt_critical_section_test_support_delay(void)
return interrupt_critical_busy_wait(); return interrupt_critical_busy_wait();
} }
static bool is_idle( const Thread_Control *thread )
{
return thread->Start.Entry.Kinds.Idle.entry
== rtems_configuration_get_idle_task();
}
static void thread_switch( Thread_Control *executing, Thread_Control *heir ) static void thread_switch( Thread_Control *executing, Thread_Control *heir )
{ {
(void) executing; (void) executing;
(void) heir; (void) heir;
if ( interrupt_critical.t1 == 0 && is_idle( heir ) ) { if ( interrupt_critical.t1 == 0 && heir->is_idle ) {
interrupt_critical.t1 = rtems_clock_get_uptime_nanoseconds(); interrupt_critical.t1 = rtems_clock_get_uptime_nanoseconds();
} }
} }