From a9f4e3d2443f96ef52e9dab4bf99206c9570bb3a Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Thu, 11 Dec 2003 17:21:39 +0100 Subject: [multiple changes] 2003-12-11 Ed Falis * 5zinit.adb: Clean up. * 5zintman.adb (Notify_Exception): replaced case statement with a call to __gnat_map_signal, imported from init.c to support signal -> exception mappings that depend on the vxWorks version. * init.c: Created and exported __gnat_map_signal to support signal -> exception mapping that is dependent on the VxWorks version. Change mapping of SIGBUS from Program_Error to Storage_Error on VxWorks 2003-12-11 Vasiliy Fofanv * 5wosinte.ads: Link with -mthreads switch. 2003-12-11 Arnaud Charlet * init.c (__gnat_install_handler [NetBSD]): Set __gnat_handler_installed, as done on all other platforms. Remove duplicated code. 2003-12-11 Jerome Guitton * Makefile.in (rts-zfp, rts-ravenscar): Create libgnat.a. 2003-12-11 Thomas Quinot * sinfo.ads: Fix inconsistent example code in comment. 2003-12-11 Robert Dewar * a-tiinau.adb: Add a couple of comments * sem_ch3.adb: Minor reformatting * sem_prag.adb: Fix bad prototype of Same_Base_Type in body (code reading cleanup) Minor reformatting throughout 2003-12-11 Ed Schonberg * exp_ch7.adb (Establish_Transient_Scope): If the call is within the bounds of a loop, create a separate block in order to generate proper cleanup actions to prevent memory leaks. * sem_res.adb (Resolve_Call): After a call to Establish_Transient_Scope, the call may be rewritten and relocated, in which case no further processing is needed. * sem_util.adb: (Wrong_Type): Refine previous fix. Fixes ACATS regressions. PR ada/13353 * sem_prag.adb (Back_End_Cannot_Inline): A renaming_as_body can always be inlined. From-SVN: r74541 --- gcc/ada/init.c | 68 ++++++++++++++++++++++++++++++---------------------------- 1 file changed, 35 insertions(+), 33 deletions(-) (limited to 'gcc/ada/init.c') diff --git a/gcc/ada/init.c b/gcc/ada/init.c index 4f50b8f..734a482 100644 --- a/gcc/ada/init.c +++ b/gcc/ada/init.c @@ -1551,6 +1551,7 @@ __gnat_initialize () extern int __gnat_inum_to_ivec (int); static void __gnat_error_handler (int, int, struct sigcontext *); +void __gnat_map_signal (int); #ifndef __alpha_vxworks @@ -1573,27 +1574,14 @@ __gnat_inum_to_ivec (int num) return INUM_TO_IVEC (num); } -static void -__gnat_error_handler (int sig, int code, struct sigcontext *sc) +/* Exported to 5zintman.adb in order to handle different signal + to exception mappings in different VxWorks versions */ +void +__gnat_map_signal (int sig) { struct Exception_Data *exception; - sigset_t mask; - int result; char *msg; - /* 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 - we unmask it. */ - sigprocmask (SIG_SETMASK, NULL, &mask); - sigdelset (&mask, sig); - sigprocmask (SIG_SETMASK, &mask, NULL); - - /* VxWorks will suspend the task when it gets a hardware exception. We - take the liberty of resuming the task for the application. */ - if (taskIsSuspended (taskIdSelf ()) != 0) - taskResume (taskIdSelf ()); - switch (sig) { case SIGFPE: @@ -1609,8 +1597,13 @@ __gnat_error_handler (int sig, int code, struct sigcontext *sc) msg = "SIGSEGV"; break; case SIGBUS: +#ifdef VTHREADS + exception = &storage_error; + msg = "SIGBUS: possible stack overflow"; +#else exception = &program_error; msg = "SIGBUS"; +#endif break; default: exception = &program_error; @@ -1620,6 +1613,29 @@ __gnat_error_handler (int sig, int code, struct sigcontext *sc) Raise_From_Signal_Handler (exception, msg); } +static void +__gnat_error_handler (int sig, int code, struct sigcontext *sc) +{ + sigset_t mask; + int result; + + /* 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 + we unmask it. */ + sigprocmask (SIG_SETMASK, NULL, &mask); + sigdelset (&mask, sig); + sigprocmask (SIG_SETMASK, &mask, NULL); + + /* VxWorks will suspend the task when it gets a hardware exception. We + take the liberty of resuming the task for the application. */ + if (taskIsSuspended (taskIdSelf ()) != 0) + taskResume (taskIdSelf ()); + + __gnat_map_signal (sig); + +} + void __gnat_install_handler (void) { @@ -1755,6 +1771,8 @@ __gnat_install_handler(void) sigaction (SIGSEGV, &act, NULL); if (__gnat_get_interrupt_state (SIGBUS) != 's') sigaction (SIGBUS, &act, NULL); + + __gnat_handler_installed = 1; } void @@ -1780,22 +1798,6 @@ __gnat_initialize (void) __gnat_install_handler (); } -/***************************************/ -/* __gnat_initialize (RTEMS version) */ -/***************************************/ - -#elif defined(__rtems__) - -extern void __gnat_install_handler (void); - -/* For RTEMS, each bsp will provide a custom __gnat_install_handler (). */ - -void -__gnat_initialize (void) -{ - __gnat_install_handler (); -} - #else /* For all other versions of GNAT, the initialize routine and handler -- cgit v1.1