suggestion for new initialization of the FPSCR-Register on PowerPC

Christian Mauderer Christian.Mauderer at
Thu Aug 6 08:04:41 UTC 2009


I've got an "unrecoverable exception!!! Push reset button" by running
the test sptests/spintrcritical07 out of the bsp-testsuite of rtems 4.10
on a Freescale MPC8313ERDB board. The error occurred directly after the
line "Support - rtems_timer_create - creating timer 1".
When searching for the reason for this exception we've found out, that
it is caused by an floating-point-operation in an interrupt-routine.
This operation takes place when the FPSCR-Register should be initialized
with _CPU_Context_Initialize_fp which is defined in the
cpukit/score/cpu/powerpc/rtems/score/cpu.h. In this function is an
assignment of the integer-constant PPC_INIT_FPSCR to that register,
which is declared as a double or float. The integer value 0xf8 in
PPC_INIT_FPSCR, which is defined in the powerpc.h, would set the
exception-bits and therefore would need an extra exception-handler to do
something with the value. Also the the transformed float-value 248.0
seems to me to make no sense for this initialization.
We would suggest an altered initialization-value of 0x0 which could be
written into the register with the following casts:
#if (PPC_HAS_DOUBLE == 1)
  #define _CPU_Context_Initialize_fp( _destination ) \
    { \
      *(uint64_t *) &((*(_destination))->fpscr) = PPC_INIT_FPSCR; \
  #define _CPU_Context_Initialize_fp( _destination ) \
    { \
      *(uint32_t *) &((*(_destination))->fpscr) = PPC_INIT_FPSCR; \

Kind regards,
Christian Mauderer

More information about the users mailing list