#4171 assigned enhancement

sparc: Remove set_vector() function

Reported by: Sebastian Huber Owned by: Sebastian Huber
Priority: normal Milestone: 6.1
Component: arch/sparc Version: 6
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

The

rtems_isr_entry set_vector(                   /* returns old vector */
  rtems_isr_entry     handler,                /* isr routine        */
  rtems_vector_number vector,                 /* vector number      */
  int                 type                    /* RTEMS or RAW intr  */
)

is an unsafe interface since it works with incompatible function pointer types by design. This leads to warnings like this:

../../../bsps/sparc/leon3/start/setvec.c: In function 'set_vector':
../../../bsps/sparc/leon3/start/setvec.c:51:43: warning: passing argument 2 of '_CPU_ISR_install_raw_handler' from incompatible pointer type [-Wincompatible-pointer-types]
   51 |     _CPU_ISR_install_raw_handler( vector, handler, (void *)&previous_isr );
      |                                           ^~~~~~~
      |                                           |
      |                                           rtems_isr_entry {aka void (*)(unsigned int)}
In file included from ../../../cpukit/include/rtems/config.h:30,
                 from ../../../cpukit/include/rtems.h:56,
                 from ../../../bsps/include/bsp/default-initial-extension.h:26,
                 from ../../../bsps/sparc/leon3/include/bsp.h:32,
                 from ../../../bsps/sparc/leon3/start/setvec.c:36:
../../../cpukit/score/cpu/sparc/include/rtems/score/cpu.h:958:24: note: expected 'CPU_ISR_raw_handler' {aka 'void (*)(void)'} but argument is of type 'rtems_isr_entry' {aka 'void (*)(unsigned int)'}
  958 |   CPU_ISR_raw_handler  new_handler,
      |   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~

The set_vector() function is undocumented.

The proposed solution is to

  1. clear and unmask the corresponding interrupts in rtems_interrupt_catch(),
  1. replace all set_vector(*, *, 1) calls wtith rtems_interrupt_catch(),
  1. verify that there are no set_vector(*, *, 0) uses, if present, then replace then with _CPU_ISR_install_raw_handler(), and
  1. remove set_vector().

Change History (4)

comment:1 Changed on Nov 6, 2020 at 1:07:30 PM by Sebastian Huber <sebastian.huber@…>

In 2c467ec/rtems:

sparc: Move SPARC-specific macros to sparc.h

Clarify Doxygen comments. Fix formatting.

Update #4171.

comment:2 Changed on Nov 6, 2020 at 1:07:33 PM by Sebastian Huber <sebastian.huber@…>

In b7271f8/rtems:

sparc: Add SPARC_IS_INTERRUPT_TRAP()

Update #4171.

comment:3 Changed on Nov 6, 2020 at 1:07:37 PM by Sebastian Huber <sebastian.huber@…>

In 82811477/rtems:

sparc: Add SPARC_INTERRUPT_TRAP_TO_SOURCE()

Update #4171.

comment:4 Changed on Nov 6, 2020 at 1:07:40 PM by Sebastian Huber <sebastian.huber@…>

In 350bba7a/rtems:

sparc: Add SPARC_INTERRUPT_SOURCE_TO_TRAP()

Update #4171.

Note: See TracTickets for help on using tickets.