[rtems commit] rtems: Relax mode checks in rtems_signal_catch()

Sebastian Huber sebh at rtems.org
Fri Mar 19 16:08:30 UTC 2021


Module:    rtems
Branch:    master
Commit:    53bd5e3246a02eff102c21d7b7a10629c5c23ff6
Changeset: http://git.rtems.org/rtems/commit/?id=53bd5e3246a02eff102c21d7b7a10629c5c23ff6

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Mar 17 08:09:49 2021 +0100

rtems: Relax mode checks in rtems_signal_catch()

Check only for invalid modes if a valid handler is presented to
rtems_signal_catch().  When NULL is used for the handler, ASR processing
is disabled and the mode is not used.

Update #4244.

---

 cpukit/rtems/src/signalcatch.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/cpukit/rtems/src/signalcatch.c b/cpukit/rtems/src/signalcatch.c
index 9907908..6924f34 100644
--- a/cpukit/rtems/src/signalcatch.c
+++ b/cpukit/rtems/src/signalcatch.c
@@ -39,7 +39,10 @@ rtems_status_code rtems_signal_catch(
   ISR_lock_Context    lock_context;
 
 #if defined(RTEMS_SMP) || CPU_ENABLE_ROBUST_THREAD_DISPATCH == TRUE
-  if ( !_Modes_Is_interrupt_level_supported( mode_set ) ) {
+  if (
+    asr_handler != NULL &&
+    !_Modes_Is_interrupt_level_supported( mode_set )
+  ) {
     return RTEMS_NOT_IMPLEMENTED;
   }
 #endif
@@ -47,7 +50,10 @@ rtems_status_code rtems_signal_catch(
   executing = _Thread_State_acquire_for_executing( &lock_context );
 
 #if defined(RTEMS_SMP)
-  if ( !_Modes_Is_preempt_mode_supported( mode_set, executing ) ) {
+  if (
+    asr_handler != NULL &&
+    !_Modes_Is_preempt_mode_supported( mode_set, executing )
+  ) {
     _Thread_State_release( executing, &lock_context );
     return RTEMS_NOT_IMPLEMENTED;
   }



More information about the vc mailing list