suggestion for new initialization of the FPSCR-Register on PowerPC

Thomas Dörfler Thomas.Doerfler at embedded-brains.de
Thu Aug 6 10:16:15 UTC 2009


Hello,

just a short note: instead of doing the unit64_t or uint32_t casts in
the initialization below, wouldn't it make sense to modify the type of
the fields -> fpscr in the fp_context structure?

Reason: AFAIK, the only accesses to this structure are done in the
mentioned file and in an assembly level file. In the assembler code, the
field fpscr is read into a fp register, but only to be directly moved to
the fpscr, so this structure field never really holds a floating point
value, which makes me regard the data type "double" as obscure anyway.

wkr,
Thomas.


Christian Mauderer wrote:
> Hello,
> 
> 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; \
>     }
> #else
>   #define _CPU_Context_Initialize_fp( _destination ) \
>     { \
>       *(uint32_t *) &((*(_destination))->fpscr) = PPC_INIT_FPSCR; \
>     }
> #endif
> 
> Kind regards,
> Christian Mauderer
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-users


-- 

--------------------------------------------
Embedded Brains GmbH
Thomas Doerfler        Obere Lagerstrasse 30
D-82178 Puchheim       Germany
email: Thomas.Doerfler at embedded-brains.de
Phone: +49-89-18908079-2
Fax:   +49-89-18908079-9



More information about the users mailing list