Commit 43316a01 by Olivier Hainque Committed by Arnaud Charlet

system-solaris-x86.ads (ZCX_By_Default): Switch to True.

2007-08-14  Olivier Hainque  <hainque@adacore.com>

	* system-solaris-x86.ads (ZCX_By_Default): Switch to True.
	(GCC_ZCX_Support): Switch to True.
	
	* s-intman-solaris.adb (Notify_Exception): Call
	Adjust_Context_For_Raise before raising, as expected for signal
	handlers in general.
	
	* s-intman-posix.adb (Notify_Exception): Remove declaration of
	Adjust_Context_For_Raise, moved to the spec of this unit to be visible
	to other implementation bodies.
	
	* s-intman.ads (Adjust_Context_For_Raise): Declare and import here, to
	be visible by multiple implementation bodies.
	
	* init.c [VMS section] (__gnat_handle_vms_condition): Adjust context
	only for conditions coming from hardware.
	[alpha-tru64 section] (__gnat_adjust_context_for_raise): Implement,
	adjustments to signal context prior to exception raise from signal
	handler.
	(__gnat_map_signal for VxWorks): Map SIGSEGV to Storage_Error in RTP
	mode.
	Solaris section: (__gnat_adjust_context_for_raise): New function.
	Implementation of the machine context adjustments to perform prior to
	raise from a signal handler. Version for both sparc and x86.
	(HAVE_GNAT_ADJUST_CONTEXT_FOR_RAISE): Define.
	(__gnat_error_handler): Expect a third argument, ucontext_t *. Adjust it
	prior to raising as expected for any handler, before possible nested
	faults to make sure all the contexts in a chain have been adjusted by
	the time we propagate.

From-SVN: r127433
parent 2cd44f5a
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -113,17 +113,6 @@ package body System.Interrupt_Management is ...@@ -113,17 +113,6 @@ package body System.Interrupt_Management is
is is
pragma Unreferenced (siginfo); pragma Unreferenced (siginfo);
-- The GCC unwinder requires adjustments to the signal's machine context
-- to be able to properly unwind through the signal handler. This is
-- achieved by the target specific subprogram below, provided by init.c
-- to be usable by the non-tasking handler also.
procedure Adjust_Context_For_Raise
(signo : Signal;
ucontext : System.Address);
pragma Import
(C, Adjust_Context_For_Raise, "__gnat_adjust_context_for_raise");
Result : Interfaces.C.int; Result : Interfaces.C.int;
begin begin
...@@ -133,8 +122,8 @@ package body System.Interrupt_Management is ...@@ -133,8 +122,8 @@ package body System.Interrupt_Management is
Result := pthread_sigmask (SIG_UNBLOCK, Signal_Mask'Access, null); Result := pthread_sigmask (SIG_UNBLOCK, Signal_Mask'Access, null);
pragma Assert (Result = 0); pragma Assert (Result = 0);
-- Perform the necessary context adjustments required by the GCC/ZCX -- Perform the necessary context adjustments prior to a raise
-- unwinder, harmless in the SJLJ case. -- from a signal handler.
Adjust_Context_For_Raise (signo, ucontext); Adjust_Context_For_Raise (signo, ucontext);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2006 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -31,14 +31,13 @@ ...@@ -31,14 +31,13 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- This is a Solaris version of this package. -- This is a Solaris version of this package
-- Make a careful study of all signals available under the OS, -- Make a careful study of all signals available under the OS, to see which
-- to see which need to be reserved, kept always unmasked, -- need to be reserved, kept always unmasked, or kept always unmasked.
-- or kept always unmasked.
-- Be on the lookout for special signals that -- Be on the lookout for special signals that may be used by the thread
-- may be used by the thread library. -- library.
package body System.Interrupt_Management is package body System.Interrupt_Management is
...@@ -73,10 +72,10 @@ package body System.Interrupt_Management is ...@@ -73,10 +72,10 @@ package body System.Interrupt_Management is
-- Notify_Exception -- -- Notify_Exception --
---------------------- ----------------------
-- This function identifies the Ada exception to be raised using -- This function identifies the Ada exception to be raised using the
-- the information when the system received a synchronous signal. -- information when the system received a synchronous signal. Since this
-- Since this function is machine and OS dependent, different code -- function is machine and OS dependent, different code has to be provided
-- has to be provided for different target. -- for different target.
procedure Notify_Exception procedure Notify_Exception
(signo : Signal; (signo : Signal;
...@@ -92,8 +91,12 @@ package body System.Interrupt_Management is ...@@ -92,8 +91,12 @@ package body System.Interrupt_Management is
info : access siginfo_t; info : access siginfo_t;
context : access ucontext_t) context : access ucontext_t)
is is
pragma Unreferenced (context);
begin begin
-- Perform the necessary context adjustments prior to a raise
-- from a signal handler.
Adjust_Context_For_Raise (signo, context.all'Address);
-- Check that treatment of exception propagation here -- Check that treatment of exception propagation here
-- is consistent with treatment of the abort signal in -- is consistent with treatment of the abort signal in
-- System.Task_Primitives.Operations. -- System.Task_Primitives.Operations.
...@@ -171,9 +174,8 @@ package body System.Interrupt_Management is ...@@ -171,9 +174,8 @@ package body System.Interrupt_Management is
Result := sigemptyset (mask'Access); Result := sigemptyset (mask'Access);
pragma Assert (Result = 0); pragma Assert (Result = 0);
-- ??? For the same reason explained above, we can't mask these -- ??? For the same reason explained above, we can't mask these signals
-- signals because otherwise we won't be able to catch more than -- because otherwise we won't be able to catch more than one signal.
-- one signal.
act.sa_mask := mask; act.sa_mask := mask;
...@@ -239,10 +241,10 @@ package body System.Interrupt_Management is ...@@ -239,10 +241,10 @@ package body System.Interrupt_Management is
Reserve (SIGINT) := False; Reserve (SIGINT) := False;
end if; end if;
-- We do not have Signal 0 in reality. We just use this value -- We do not have Signal 0 in reality. We just use this value to
-- to identify not existing signals (see s-intnam.ads). Therefore, -- identify not existing signals (see s-intnam.ads). Therefore, Signal 0
-- Signal 0 should not be used in all signal related operations hence -- should not be used in all signal related operations hence mark it as
-- mark it as reserved. -- reserved.
Reserve (0) := True; Reserve (0) := True;
end Initialize; end Initialize;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -70,10 +70,8 @@ package System.Interrupt_Management is ...@@ -70,10 +70,8 @@ package System.Interrupt_Management is
-- systems, but is always reserved when it is defined. If we have the -- systems, but is always reserved when it is defined. If we have the
-- convention that ID zero is not used for any "real" signals, and SIGRARE -- convention that ID zero is not used for any "real" signals, and SIGRARE
-- = 0 when SIGRARE is not one of the locally supported signals, we can -- = 0 when SIGRARE is not one of the locally supported signals, we can
-- write -- write:
-- Reserved (SIGRARE) := True; -- Reserved (SIGRARE) := True;
-- and the initialization code will be portable. -- and the initialization code will be portable.
Abort_Task_Interrupt : Interrupt_ID; Abort_Task_Interrupt : Interrupt_ID;
...@@ -96,13 +94,22 @@ package System.Interrupt_Management is ...@@ -96,13 +94,22 @@ package System.Interrupt_Management is
-- or used to implement time delays. -- or used to implement time delays.
procedure Initialize; procedure Initialize;
-- Initialize the various variables defined in this package. -- Initialize the various variables defined in this package. This procedure
-- This procedure must be called before accessing any object from this -- must be called before accessing any object from this package, and can be
-- package, and can be called multiple times. -- called multiple times.
private private
type Interrupt_Mask is new System.OS_Interface.sigset_t; type Interrupt_Mask is new System.OS_Interface.sigset_t;
-- In some implementations Interrupt_Mask can be represented as a linked -- In some implementations Interrupt_Mask is represented as a linked list
-- list.
procedure Adjust_Context_For_Raise
(Signo : System.OS_Interface.Signal;
Ucontext : System.Address);
pragma Import
(C, Adjust_Context_For_Raise, "__gnat_adjust_context_for_raise");
-- Target specific hook performing adjustments to the signal's machine
-- context, to be called before an exception may be raised from a signal
-- handler. This service is provided by init.c, together with the
-- non-tasking signal handler.
end System.Interrupt_Management; end System.Interrupt_Management;
...@@ -139,7 +139,7 @@ private ...@@ -139,7 +139,7 @@ private
Support_Long_Shifts : constant Boolean := True; Support_Long_Shifts : constant Boolean := True;
Suppress_Standard_Library : constant Boolean := False; Suppress_Standard_Library : constant Boolean := False;
Use_Ada_Main_Program_Name : constant Boolean := False; Use_Ada_Main_Program_Name : constant Boolean := False;
ZCX_By_Default : constant Boolean := False; ZCX_By_Default : constant Boolean := True;
GCC_ZCX_Support : constant Boolean := False; GCC_ZCX_Support : constant Boolean := True;
end System; end System;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment