Adjust interrupt mode tests for some CPU ports

In case the robust thread dispatch is enabled by the CPU port, then the
interrupt level must not be changed through the task mode.

Update #3000.
This commit is contained in:
Sebastian Huber
2019-01-08 09:53:26 +01:00
parent 1f28518675
commit 3bd3999936
5 changed files with 36 additions and 7 deletions

View File

@@ -53,11 +53,13 @@ rtems_status_code rtems_task_mode(
}
#endif
#if defined(RTEMS_SMP)
#if defined(RTEMS_SMP) || CPU_ENABLE_ROBUST_THREAD_DISPATCH == TRUE
if (
( mask & RTEMS_INTERRUPT_MASK ) != 0
&& _Modes_Get_interrupt_level( mode_set ) != 0
#if CPU_ENABLE_ROBUST_THREAD_DISPATCH == FALSE
&& rtems_configuration_is_smp_enabled()
#endif
) {
return RTEMS_NOT_IMPLEMENTED;
}

View File

@@ -261,7 +261,7 @@ void _Thread_Do_dispatch( Per_CPU_Control *cpu_self, ISR_Level level )
#if defined(RTEMS_SCORE_ROBUST_THREAD_DISPATCH)
if (
!_ISR_Is_enabled( level )
#if defined(RTEMS_SMP)
#if defined(RTEMS_SMP) && CPU_ENABLE_ROBUST_THREAD_DISPATCH == FALSE
&& rtems_configuration_is_smp_enabled()
#endif
) {

View File

@@ -64,10 +64,12 @@ bool _Thread_Initialize(
}
#endif
#if defined(RTEMS_SMP)
#if defined(RTEMS_SMP) || CPU_ENABLE_ROBUST_THREAD_DISPATCH == TRUE
if (
isr_level != 0
#if CPU_ENABLE_ROBUST_THREAD_DISPATCH == FALSE
&& rtems_configuration_is_smp_enabled()
#endif
) {
return false;
}

View File

@@ -175,7 +175,7 @@ rtems_task Init(
/* END OF RTEMS_PREEMPT */
/* BEGINNING OF RTEMS_INTERRUPT_LEVEL */
#if !defined(RTEMS_SMP)
#if CPU_ENABLE_ROBUST_THREAD_DISPATCH == FALSE
status = rtems_task_mode(
RTEMS_INTERRUPT_LEVEL(3),
RTEMS_INTERRUPT_MASK,
@@ -197,13 +197,25 @@ rtems_task Init(
"TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 5 ) - previous mode: ",
previous_mode
);
#else
status = rtems_task_mode(
RTEMS_INTERRUPT_LEVEL( 1 ),
RTEMS_INTERRUPT_MASK,
&previous_mode
);
fatal_directive_status( status, RTEMS_NOT_IMPLEMENTED, "rtems_task_mode" );
#endif
/* END OF RTEMS_INTERRUPT_LEVEL */
/* BEGINNING OF COMBINATIONS */
status = rtems_task_mode(
RTEMS_INTERRUPT_LEVEL(3) | RTEMS_NO_ASR |
#if CPU_ENABLE_ROBUST_THREAD_DISPATCH == TRUE
RTEMS_INTERRUPT_LEVEL(0) |
#else
RTEMS_INTERRUPT_LEVEL(3) |
#endif
RTEMS_NO_ASR |
RTEMS_TIMESLICE | RTEMS_NO_PREEMPT,
RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK |
RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK,
@@ -216,7 +228,12 @@ rtems_task Init(
);
status = rtems_task_mode(
RTEMS_INTERRUPT_LEVEL(3) | RTEMS_NO_ASR |
#if CPU_ENABLE_ROBUST_THREAD_DISPATCH == TRUE
RTEMS_INTERRUPT_LEVEL(0) |
#else
RTEMS_INTERRUPT_LEVEL(3) |
#endif
RTEMS_NO_ASR |
RTEMS_TIMESLICE | RTEMS_NO_PREEMPT,
RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK |
RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK,

View File

@@ -76,11 +76,19 @@ static void test_isr_level_for_new_threads( ISR_Level last_proper_level )
};
for ( current = 0 ; current <= mask ; ++current ) {
rtems_mode initial_modes = RTEMS_INTERRUPT_LEVEL(current);
rtems_mode initial_modes;
rtems_id id;
rtems_status_code sc;
rtems_event_set events;
initial_modes = RTEMS_INTERRUPT_LEVEL(current);
#if CPU_ENABLE_ROBUST_THREAD_DISPATCH == TRUE
if ( initial_modes != 0 ) {
break;
}
#endif
ctx.actual_level = 0xffffffff;
sc = rtems_task_create(