Changeset 080dc5d in rtems


Ignore:
Timestamp:
10/25/22 17:41:27 (7 months ago)
Author:
Kinsey Moore <kinsey.moore@…>
Branches:
master
Children:
0f92310
Parents:
698227e6
git-author:
Kinsey Moore <kinsey.moore@…> (10/25/22 17:41:27)
git-committer:
Joel Sherrill <joel@…> (11/09/22 14:14:11)
Message:

cpukit/aarch64: Emulate FPSR for FENV traps

The AArch64 TRM specifies that when FPCR is set to trap floating point
exceptions, the FPSR exception bits are not set. This ensures that FPSR
is updated as FENV expects even if floating point exception traps are
enabled.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/cpu/aarch64/aarch64-exception-default.c

    r698227e6 r080dc5d  
    4949void _AArch64_Exception_default( CPU_Exception_frame *frame )
    5050{
     51  uint64_t EC = AARCH64_ESR_EL1_EC_GET( frame->register_syndrome );
     52
     53  /* Emulate FPSR flags for FENV if a FPU exception occurred */
     54  if ( EC == 0x2c ) {
     55    /*
     56     * This must be done because FENV depends on FPSR values, but trapped FPU
     57     * exceptions don't set FPSR bits. In the case where a signal is mapped, the
     58     * signal code executes after the exception frame is restored and FENV
     59     * functions executed in that context will need this information to be
     60     * accurate.
     61     */
     62    uint64_t ISS = AARCH64_ESR_EL1_EC_GET( frame->register_syndrome );
     63
     64    /* If the exception bits are valid, use them */
     65    if ( ( ISS & ( 1 << 23 ) ) != 0 ) {
     66      /* The bits of the lower byte match the FPSR exception bits */
     67      frame->register_fpsr |= ( ISS & 0xff );
     68    }
     69  }
     70
    5171  rtems_fatal( RTEMS_FATAL_SOURCE_EXCEPTION, (rtems_fatal_code) frame );
    5272}
Note: See TracChangeset for help on using the changeset viewer.