[PATCH v3 4/5] cpukit: Add signal mapping support

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Oct 28 06:02:40 UTC 2021


On 27/10/2021 23:44, Kinsey Moore wrote:
> +/*
> + * Exception handler. Map the exception class to SIGFPE, SIGSEGV
> + * or SIGILL for Ada or other runtimes.
> + */
> +void _Exception_Raise_signal(
> +  Internal_errors_Source source,
> +  bool                   always_set_to_false,
> +  Internal_errors_t      code
> +)
> +{
> +  CPU_Exception_frame *ef;
> +  int raise_signal;
> +
> +  if ( source != RTEMS_FATAL_SOURCE_EXCEPTION ) {
> +    return;
> +  }
> +
> +  ef = (rtems_exception_frame *) code;
> +  raise_signal = _CPU_Exception_frame_get_signal( ef );
> +  if ( raise_signal < 0 ) {
> +    return;
> +  }
> +
> +  /* Disable thread dispatch */
> +  _CPU_Exception_disable_thread_dispatch();
> +
> +  /*
> +   * While it would be preferable, the call to raise() cannot be deferred to a
> +   * post-switch action because it attempts to lock the post-switch action list
> +   * to add another item and the list is already locked for iteration. This
> +   * causes a deadlock.
> +   */
> +  raise( raise_signal );

When you get an early exception (before RTEMS is initialized), then you 
get a double exception here or some sort of undefined behaviour.

> +
> +  /* Perform dispatch and resume execution */
> +  _CPU_Exception_dispatch_and_resume( ef );
> +}

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at 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/


More information about the devel mailing list