OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [ada/] [s-intman-irix.adb] - Blame information for rev 749

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 706 jeremybenn
------------------------------------------------------------------------------
2
--                                                                          --
3
--                 GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS                 --
4
--                                                                          --
5
--           S Y S T E M . I N T E R R U P T _ M A N A G E M E N T          --
6
--                                                                          --
7
--                                  B o d y                                 --
8
--                                                                          --
9
--                      Copyright (C) 1995-2010, AdaCore                    --
10
--                                                                          --
11
-- GNAT is free software;  you can  redistribute it  and/or modify it under --
12
-- terms of the  GNU General Public License as published  by the Free Soft- --
13
-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
14
-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
15
-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
16
-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
17
--                                                                          --
18
-- As a special exception under Section 7 of GPL version 3, you are granted --
19
-- additional permissions described in the GCC Runtime Library Exception,   --
20
-- version 3.1, as published by the Free Software Foundation.               --
21
--                                                                          --
22
-- You should have received a copy of the GNU General Public License and    --
23
-- a copy of the GCC Runtime Library Exception along with this program;     --
24
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
25
-- <http://www.gnu.org/licenses/>.                                          --
26
--                                                                          --
27
-- GNARL was developed by the GNARL team at Florida State University.       --
28
-- Extensive contributions were provided by Ada Core Technologies, Inc.     --
29
--                                                                          --
30
------------------------------------------------------------------------------
31
 
32
--  This is a SGI Pthread version of this package
33
 
34
--  Make a careful study of all signals available under the OS, to see which
35
--  need to be reserved, kept always unmasked, or kept always unmasked. Be on
36
--  the lookout for special signals that may be used by the thread library.
37
 
38
package body System.Interrupt_Management is
39
 
40
   use System.OS_Interface;
41
 
42
   type Interrupt_List is array (Interrupt_ID range <>) of Interrupt_ID;
43
   Exception_Interrupts : constant Interrupt_List :=
44
     (SIGTSTP, SIGILL, SIGTRAP, SIGEMT, SIGFPE, SIGBUS, SIGSTOP, SIGKILL,
45
      SIGSEGV, SIGSYS, SIGXCPU, SIGXFSZ, SIGPROF, SIGPTINTR, SIGPTRESCHED,
46
      SIGABRT, SIGPIPE);
47
 
48
   Unreserve_All_Interrupts : Interfaces.C.int;
49
   pragma Import
50
     (C, Unreserve_All_Interrupts, "__gl_unreserve_all_interrupts");
51
 
52
   function State (Int : Interrupt_ID) return Character;
53
   pragma Import (C, State, "__gnat_get_interrupt_state");
54
 
55
   --  Get interrupt state.  Defined in a-init.c
56
   --  The input argument is the interrupt number,
57
   --  and the result is one of the following:
58
 
59
   User    : constant Character := 'u';
60
   Runtime : constant Character := 'r';
61
   Default : constant Character := 's';
62
   --    'n'   this interrupt not set by any Interrupt_State pragma
63
   --    'u'   Interrupt_State pragma set state to User
64
   --    'r'   Interrupt_State pragma set state to Runtime
65
   --    's'   Interrupt_State pragma set state to System (use "default"
66
   --           system handler)
67
 
68
   ----------------
69
   -- Initialize --
70
   ----------------
71
 
72
   Initialized : Boolean := False;
73
 
74
   procedure Initialize is
75
      use type Interfaces.C.int;
76
   begin
77
      if Initialized then
78
         return;
79
      end if;
80
 
81
      Initialized := True;
82
      Abort_Task_Interrupt := SIGABRT;
83
 
84
      --  Change this if you want to use another signal for task abort.
85
      --  SIGTERM might be a good one.
86
 
87
      pragma Assert (Keep_Unmasked = (Interrupt_ID'Range => False));
88
      pragma Assert (Reserve = (Interrupt_ID'Range => False));
89
 
90
      --  Process state of exception signals
91
 
92
      for J in Exception_Interrupts'Range loop
93
         if State (Exception_Interrupts (J)) /= User then
94
            Keep_Unmasked (Exception_Interrupts (J)) := True;
95
            Reserve (Exception_Interrupts (J)) := True;
96
         end if;
97
      end loop;
98
 
99
      if State (Abort_Task_Interrupt) /= User then
100
         Keep_Unmasked (Abort_Task_Interrupt) := True;
101
         Reserve (Abort_Task_Interrupt) := True;
102
      end if;
103
 
104
      --  Set SIGINT to unmasked state as long as it's
105
      --  not in "User" state.  Check for Unreserve_All_Interrupts last
106
 
107
      if State (SIGINT) /= User then
108
         Keep_Unmasked (SIGINT) := True;
109
      end if;
110
 
111
      --  Check all signals for state that requires keeping them
112
      --  unmasked and reserved
113
 
114
      for J in Interrupt_ID'Range loop
115
         if State (J) = Default or else State (J) = Runtime then
116
            Keep_Unmasked (J) := True;
117
            Reserve (J) := True;
118
         end if;
119
      end loop;
120
 
121
      --  Process pragma Unreserve_All_Interrupts. This overrides any
122
      --  settings due to pragma Interrupt_State:
123
 
124
      if Unreserve_All_Interrupts /= 0 then
125
         Keep_Unmasked (SIGINT) := False;
126
         Reserve (SIGINT) := False;
127
      end if;
128
 
129
      --  We do not have Signal 0 in reality. We just use this value
130
      --  to identify not existing signals (see s-intnam.ads). Therefore,
131
      --  Signal 0 should not be used in all signal related operations hence
132
      --  mark it as reserved.
133
 
134
      Reserve (0) := True;
135
   end Initialize;
136
 
137
end System.Interrupt_Management;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.