[Ada] Part of support for ZCX on ppc-vxworks
Arnaud Charlet
charlet@adacore.com
Wed Apr 9 07:20:00 GMT 2008
Manually tested on ppc-vxworks
Tested on i686-linux, committed on trunk
We used to have (sketchy)
init.c
__gnat_map_signal () { }
static __gnat_error_handler ()
{ sigprocmask();
__gnat_map_signal();
}
s-intman.adb
Notify_Exception ()
begin
pthread_sigmask(); /* sigprocmask imported. */
Map_And_Raise(); /* __gnat_map_signal imported. */
end;
__gnat_error_handler now adjusts the signal context as required,
Notify_Exception should be doing the same.
This change eliminates the Notify_Exception body altogether, imports
the full __gnat_error_handler directly instead and the __gnat_map_signal
import is now useless.
2008-04-08 Olivier Hainque <hainque@adacore.com>
* s-intman-vxworks.ads, s-intman-vxworks.adb
(Map_And_Raise_Exception): Remove. Was an import of only part of the
required services already implemented elsewhere.
(Notify_Exception): Delete body, import __gnat_error_handler instead.
(Initialize): Add SA_SIGINFO to the sa_flags, to get the sigcontext
argument passed to the handler, which we need for ZCX propagation
purposes.
-------------- next part --------------
Index: s-intman-vxworks.ads
===================================================================
--- s-intman-vxworks.ads (revision 133957)
+++ s-intman-vxworks.ads (working copy)
@@ -103,9 +103,9 @@ package System.Interrupt_Management is
-- each task.
procedure Initialize;
- -- Initialize the various variables defined in this package.
- -- This procedure must be called before accessing any object from this
- -- package and can be called multiple times.
+ -- Initialize the various variables defined in this package. This procedure
+ -- must be called before accessing any object from this package and can be
+ -- called multiple times (only the first call has any effect).
private
type Interrupt_Mask is new System.OS_Interface.sigset_t;
Index: s-intman-vxworks.adb
===================================================================
--- s-intman-vxworks.adb (revision 133957)
+++ s-intman-vxworks.adb (working copy)
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
-- --
-- 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- --
@@ -49,8 +49,11 @@ package body System.Interrupt_Management
Exception_Action : aliased struct_sigaction;
-- Keep this variable global so that it is initialized only once
- procedure Map_And_Raise_Exception (signo : Signal);
- pragma Import (C, Map_And_Raise_Exception, "__gnat_map_signal");
+ procedure Notify_Exception
+ (signo : Signal;
+ siginfo : System.Address;
+ sigcontext : System.Address);
+ pragma Import (C, Notify_Exception, "__gnat_error_handler");
-- Map signal to Ada exception and raise it. Different versions
-- of VxWorks need different mappings.
@@ -71,28 +74,6 @@ package body System.Interrupt_Management
-- 's' Interrupt_State pragma set state to System (use "default"
-- system handler)
- procedure Notify_Exception (signo : Signal);
- -- Identify the Ada exception to be raised using
- -- the information when the system received a synchronous signal.
-
- ----------------------
- -- Notify_Exception --
- ----------------------
-
- procedure Notify_Exception (signo : Signal) is
- Mask : aliased sigset_t;
-
- Result : int;
- pragma Unreferenced (Result);
-
- begin
- Result := pthread_sigmask (SIG_SETMASK, null, Mask'Access);
- Result := sigdelset (Mask'Access, signo);
- Result := pthread_sigmask (SIG_SETMASK, Mask'Access, null);
-
- Map_And_Raise_Exception (signo);
- end Notify_Exception;
-
---------------------------
-- Initialize_Interrupts --
---------------------------
@@ -118,10 +99,12 @@ package body System.Interrupt_Management
----------------
Initialized : Boolean := False;
+ -- Set to True once Initialize is called, further calls have no effect
procedure Initialize is
mask : aliased sigset_t;
Result : int;
+
begin
if Initialized then
return;
@@ -135,7 +118,7 @@ package body System.Interrupt_Management
Abort_Task_Interrupt := SIGABRT;
Exception_Action.sa_handler := Notify_Exception'Address;
- Exception_Action.sa_flags := SA_ONSTACK;
+ Exception_Action.sa_flags := SA_ONSTACK + SA_SIGINFO;
Result := sigemptyset (mask'Access);
pragma Assert (Result = 0);
More information about the Gcc-patches
mailing list