#3077 closed enhancement (fixed)

SPARC: Add lazy floating point context switching

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

Description

The uniprocessor floating point context switching is unsafe, e.g. it is possible to silently corrupt the floating point context. The SMP floating point switching is safe, however, it doesn't use a deferred switch. Implement lazy floating point switching in uniprocessor configurations. This fixes test case spcontext01.

Change History (7)

comment:1 Changed on 07/25/17 at 09:44:32 by Sebastian Huber <sebastian.huber@…>

In b2e1bded/rtems:

score: Add optional _CPU_Context_Destroy()

Update #3077.

comment:2 Changed on 07/25/17 at 09:44:44 by Sebastian Huber <sebastian.huber@…>

In a400d06f/rtems:

sparc: Rename SPARC_USE_SAFE_FP_SUPPORT

Rename SPARC_USE_SAFE_FP_SUPPORT in SPARC_USE_SYNCHRONOUS_FP_SWITCH.
Update comment.

Update #3077.

comment:3 Changed on 07/25/17 at 09:44:55 by Sebastian Huber <sebastian.huber@…>

In 600d88d/rtems:

INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT

Add new fatal error INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT.

Update #3077.

comment:4 Changed on 07/25/17 at 09:45:08 by Sebastian Huber <sebastian.huber@…>

In 146adb1/rtems:

sparc: Add lazy floating point switch

The SPARC ABI is a bit special with respect to the floating point context.
The complete floating point context is volatile. Thus, from an ABI point
of view nothing needs to be saved and restored during a context switch.
Instead the floating point context must be saved and restored during
interrupt processing. Historically, the deferred floating point switch was
used for SPARC and the complete floating point context is saved and
restored during a context switch to the new floating point unit owner.
This is a bit dangerous since post-switch actions (e.g. signal handlers)
and context switch extensions may silently corrupt the floating point
context.

The floating point unit is disabled for interrupt handlers. Thus, in case
an interrupt handler uses the floating point unit then this will result in a
trap (INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT).

In uniprocessor configurations, a lazy floating point context switch is
used. In case an active floating point thread is interrupted (PSR[EF] == 1)
and a thread dispatch is carried out, then this thread is registered as the
floating point owner. When a floating point owner is present during a
context switch, the floating point unit is disabled for the heir thread
(PSR[EF] == 0). The floating point disabled trap checks that the use of the
floating point unit is allowed and saves/restores the floating point context
on demand.

Update #3077.

comment:5 Changed on 08/24/17 at 06:31:01 by Sebastian Huber

Resolution: fixed
Status: assignedclosed

Tested using the SIS.

comment:6 Changed on 10/16/17 at 06:20:09 by Sebastian Huber

Component: scorearch/sparc

comment:7 Changed on 11/09/17 at 06:27:14 by Sebastian Huber

Milestone: 4.12.05.1

Milestone renamed

Note: See TracTickets for help on using tickets.