init.c: Reuse PA/HP-UX code for IA-64/HP-UX, except __gnat_adjust_context_for_raise.

2007-04-06  Eric Botcazou <botcazou@adacore.com>
	    Arnaud Charlet  <charlet@adacore.com>

	* init.c: Reuse PA/HP-UX code for IA-64/HP-UX, except
	__gnat_adjust_context_for_raise.
	(__gnat_init_float): on x86 vxworks 5.x and 6.x, we use the same
	implementation of floating point operations as native x86 targets.
	So the FPU should be initialized in the same way using finit. Fix
	floating point operations accuracy issues.
	(__gnat_install_handler, case FreeBSD): Use proper type for sa_sigaction
	member in struct sigaction, so as to avoid warning for incompatible
	pointer types.

From-SVN: r123580
This commit is contained in:
Eric Botcazou 2007-04-06 11:23:33 +02:00 committed by Arnaud Charlet
parent 815f44d0cd
commit 00f74faf0a
1 changed files with 16 additions and 5 deletions

View File

@ -447,11 +447,11 @@ __gnat_machine_state_length (void)
return sizeof (struct sigcontext);
}
/********************/
/* PA HP-UX section */
/********************/
/*****************/
/* HP-UX section */
/*****************/
#elif defined (__hppa__) && defined (__hpux__)
#elif defined (__hpux__)
#include <signal.h>
#include <sys/ucontext.h>
@ -459,6 +459,8 @@ __gnat_machine_state_length (void)
static void
__gnat_error_handler (int sig, siginfo_t *siginfo, void *ucontext);
#if defined (__hppa__)
/* __gnat_adjust_context_for_raise - see comments along with the default
version later in this file. */
@ -475,6 +477,8 @@ __gnat_adjust_context_for_raise (int signo ATTRIBUTE_UNUSED, void *ucontext)
mcontext->ss_narrow.ss_pcoq_head ++;
}
#endif
static void
__gnat_error_handler
(int sig, siginfo_t *siginfo ATTRIBUTE_UNUSED, void *ucontext)
@ -1627,7 +1631,8 @@ __gnat_install_handler ()
exceptions. Make sure that the handler isn't interrupted by another
signal that might cause a scheduling event! */
act.sa_handler = __gnat_error_handler;
act.sa_sigaction
= (void (*)(int, struct __siginfo *, void*)) __gnat_error_handler;
act.sa_flags = SA_NODEFER | SA_RESTART | SA_SIGINFO;
(void) sigemptyset (&act.sa_mask);
@ -1805,6 +1810,12 @@ __gnat_init_float (void)
asm ("mtfsb0 26");
#endif
#if (defined (__i386__) || defined (i386)) && !defined (VTHREADS)
/* This is used to properly initialize the FPU on an x86 for each
process thread. */
asm ("finit");
#endif
/* Similarly for sparc64. Achieved by masking bits in the Trap Enable Mask
field of the Floating-point Status Register (see the SPARC Architecture
Manual Version 9, p 48). */