Notice: We have migrated to GitLab launching 2024-05-01 see here:

#4459 closed defect (fixed)

Handling of unexpected traps is unreliable on SPARC

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


Currently, all traps without special functions are handled by _ISR_Handler(). For traps which occur for example due to

  • instruction access exception
  • illegal instruction
  • privileged instruction
  • fp disabled
  • memory address not aligned
  • fp exception
  • data access exception

errors the trap handling is unreliable since

  1. the stack pointer of the context which caused the trap is used, and
  1. writeable data structures are used (for example _ISR_Vector_table).

The trap table is initialized to "ta 0" which ends up in a system error mode. In this mode, the RTEMS fatal error handling is by passed and the initial fatal error handlers are not called.

The trap handling should be changed to invoke a statically initialized bad trap handler which performs the RTEMS fatal error procedure and uses a CPU-specific stack with minimum dependencies on the context which caused the trap.

Change History (4)

comment:1 Changed on 06/24/21 at 10:30:30 by Sebastian Huber <sebastian.huber@…>

In [changeset:"955c045b3c66c26899d65dde744d5647588ca91c/rtems" 955c045b/rtems]:

sparc: Move ISR handler install routines

Move _CPU_ISR_install_raw_handler() and _CPU_ISR_install_vector() to separate
files. The goal is to make their use optional.

Update #4458.
Update #4459.

comment:2 Changed on 06/24/21 at 10:30:33 by Sebastian Huber <sebastian.huber@…>

In [changeset:"d73e657e063e3d34db16fa4bce6c2ab1e5e22ec4/rtems" d73e657e/rtems]:

sparc: More reliable bad trap handling

Statically initialize the trap table in start.S to jump to _SPARC_Bad_trap()
for all unexpected traps. This enables a proper RTEMS fatal error handling
right from the start. Do not rely on the stack and register settings which
caused an unexpected trap. Use the ISR stack of the processor to do the fatal
error handling. Save the full context which caused the trap. Fatal error
handler may use it for error logging.

Unify the _CPU_Exception_frame_print() implementations and move it to cpukit.

Update #4459.

comment:3 Changed on 12/02/21 at 15:21:46 by Sebastian Huber <sebastian.huber@…>

In [changeset:"87d1f4d762769c05e4fb950a739c57f610187665/rtems-docs" 87d1f4d/rtems-docs]:

cpu-supplement: Use REG for SPARC registers

Update #4459.

comment:4 Changed on 12/02/21 at 15:21:48 by Sebastian Huber <sebastian.huber@…>

Resolution: fixed
Status: assignedclosed

In [changeset:"835ece14cca47f51d8f3e8088019f0ffa761e702/rtems-docs" 835ece1/rtems-docs]:

cpu-supplement: Update trap handling for SPARC

Close #4459.

Note: See TracTickets for help on using tickets.