diff options
Diffstat (limited to 'gcc/ada/init.c')
-rw-r--r-- | gcc/ada/init.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/ada/init.c b/gcc/ada/init.c index c76ae646b67..1db30099317 100644 --- a/gcc/ada/init.c +++ b/gcc/ada/init.c @@ -46,6 +46,7 @@ that the __vxworks header appear before any other include. */ #ifdef __vxworks #include "vxWorks.h" +#include "version.h" /* for _WRS_VXWORKS_MAJOR */ #endif #ifdef __ANDROID__ @@ -1916,6 +1917,20 @@ __gnat_error_handler (int sig, siginfo_t *si, void *sc) { sigset_t mask; + /* VxWorks 7 on e500v2 clears the SPE bit of the MSR when entering CPU + exception state. To allow the handler and exception to work properly + when they contain SPE instructions, we need to set it back before doing + anything else. */ +#if (CPU == PPCE500V2) && (_WRS_VXWORKS_MAJOR == 7) + register unsigned msr; + /* Read the MSR value */ + asm volatile ("mfmsr %0" : "=r" (msr)); + /* Force the SPE bit */ + msr |= 0x02000000; + /* Store to MSR */ + asm volatile ("mtmsr %0" : : "r" (msr)); +#endif + /* VxWorks will always mask out the signal during the signal handler and will reenable it on a longjmp. GNAT does not generate a longjmp to return from a signal handler so the signal will still be masked unless |