On Thu, Feb 18, 2021 at 11:32 AM Gedare Bloom <ged...@rtems.org> wrote:
> On Wed, Feb 17, 2021 at 12:30 PM Sebastian Huber > <sebastian.hu...@embedded-brains.de> wrote: > > > > Ensure that no invalid modes are set during ASR processing. > > > > Update #4244. > > --- > > cpukit/rtems/src/signalcatch.c | 27 +++++++++++++++++++++++++++ > > 1 file changed, 27 insertions(+) > > > > diff --git a/cpukit/rtems/src/signalcatch.c > b/cpukit/rtems/src/signalcatch.c > > index 8ee22e5ec1..da56d26dc5 100644 > > --- a/cpukit/rtems/src/signalcatch.c > > +++ b/cpukit/rtems/src/signalcatch.c > > @@ -22,7 +22,10 @@ > > #endif > > > > #include <rtems/rtems/signalimpl.h> > > +#include <rtems/rtems/modesimpl.h> > > #include <rtems/rtems/tasksdata.h> > > +#include <rtems/score/schedulerimpl.h> > > +#include <rtems/score/smpimpl.h> > > #include <rtems/score/threadimpl.h> > > > > RTEMS_STATIC_ASSERT( RTEMS_DEFAULT_MODES == 0, _ASR_Create_mode_set ); > > @@ -37,7 +40,31 @@ rtems_status_code rtems_signal_catch( > > ASR_Information *asr; > > ISR_lock_Context lock_context; > > > > +#if defined(RTEMS_SMP) || CPU_ENABLE_ROBUST_THREAD_DISPATCH == TRUE > > + if ( > > + _Modes_Get_interrupt_level( mode_set ) != 0 > > +#if CPU_ENABLE_ROBUST_THREAD_DISPATCH == FALSE > > + && _SMP_Need_inter_processor_interrupts() > > +#endif > > + ) { > > + return RTEMS_NOT_IMPLEMENTED; > > + } > > +#endif > > + > > executing = _Thread_State_acquire_for_executing( &lock_context ); > > + > > +#if defined(RTEMS_SMP) > add a brief comment here, the logic a little complicated with > double-negatives, e.g., > /* Check for non-preempt mode requested with a scheduler that does not > support non-preemption */ > I think I have seen a very similar check in other places. Can this combination of logic be turned into a macro which has a better name? > > + if ( > > + !_Modes_Is_preempt( mode_set ) && > > + !_Scheduler_Is_non_preempt_mode_supported( > no indent (align the !) > > > + _Thread_Scheduler_get_home( executing ) > > + ) > > + ) { > > + _Thread_State_release( executing, &lock_context ); > > + return RTEMS_NOT_IMPLEMENTED; > > + } > > +#endif > > + > > api = executing->API_Extensions[ THREAD_API_RTEMS ]; > > asr = &api->Signal; > > asr->handler = asr_handler; > > -- > > 2.26.2 > > > > _______________________________________________ > > devel mailing list > > devel@rtems.org > > http://lists.rtems.org/mailman/listinfo/devel > _______________________________________________ > devel mailing list > devel@rtems.org > http://lists.rtems.org/mailman/listinfo/devel >
_______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel