On 18/02/2021 20:29, Joel Sherrill wrote:



On Thu, Feb 18, 2021 at 11:32 AM Gedare Bloom <ged...@rtems.org <mailto:ged...@rtems.org>> wrote:

    On Wed, Feb 17, 2021 at 12:30 PM Sebastian Huber
    <sebastian.hu...@embedded-brains.de
    <mailto: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?
What about _Modes_Is_preempt_mode_implemented() and _Modes_Is_interrupt_level_implemented()?

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to