* c-decl.c (duplicate_decls): Conditionalize DECL_SAVED_TREE copy.
[official-gcc.git] / gcc / ada / 5vintman.ads
blob0b8744b838d887e2cda87d4722b9eb93f9430670
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNU ADA 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 -- S p e c --
8 -- --
9 -- $Revision$
10 -- --
11 -- Copyright (C) 1991-2001 Free Software Foundation, Inc. --
12 -- --
13 -- GNARL is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNARL; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
23 -- --
24 -- As a special exception, if other files instantiate generics from this --
25 -- unit, or you link this unit with other files to produce an executable, --
26 -- this unit does not by itself cause the resulting executable to be --
27 -- covered by the GNU General Public License. This exception does not --
28 -- however invalidate any other reasons why the executable file might be --
29 -- covered by the GNU Public License. --
30 -- --
31 -- GNARL was developed by the GNARL team at Florida State University. It is --
32 -- now maintained by Ada Core Technologies Inc. in cooperation with Florida --
33 -- State University (http://www.gnat.com). --
34 -- --
35 ------------------------------------------------------------------------------
37 -- This is the Alpha/VMS version of this package.
39 -- This package encapsulates and centralizes information about
40 -- all uses of interrupts (or signals), including the
41 -- target-dependent mapping of interrupts (or signals) to exceptions.
43 -- PLEASE DO NOT add any with-clauses to this package.
44 -- This is designed to work for both tasking and non-tasking systems,
45 -- without pulling in any of the tasking support.
47 -- PLEASE DO NOT remove the Elaborate_Body pragma from this package.
48 -- Elaboration of this package should happen early, as most other
49 -- initializations depend on it.
50 -- Forcing immediate elaboration of the body also helps to enforce
51 -- the design assumption that this is a second-level
52 -- package, just one level above System.OS_Interface, with no
53 -- cross-dependences.
55 -- PLEASE DO NOT put any subprogram declarations with arguments of
56 -- type Interrupt_ID into the visible part of this package.
57 -- The type Interrupt_ID is used to derive the type in Ada.Interrupts,
58 -- and adding more operations to that type would be illegal according
59 -- to the Ada Reference Manual. (This is the reason why the signals sets
60 -- below are implemented as visible arrays rather than functions.)
62 with System.OS_Interface;
63 -- used for Signal
64 -- sigset_t
66 package System.Interrupt_Management is
68 pragma Elaborate_Body;
70 type Interrupt_Mask is limited private;
72 type Interrupt_ID is new System.OS_Interface.Signal;
74 type Interrupt_Set is array (Interrupt_ID) of Boolean;
76 -- The following objects serve as constants, but are initialized
77 -- in the body to aid portability. This permits us
78 -- to use more portable names for interrupts,
79 -- where distinct names may map to the same interrupt ID value.
80 -- For example, suppose SIGRARE is a signal that is not defined on
81 -- all systems, but is always reserved when it is defined.
82 -- If we have the convention that ID zero is not used for any "real"
83 -- signals, and SIGRARE = 0 when SIGRARE is not one of the locally
84 -- supported signals, we can write
85 -- Reserved (SIGRARE) := true;
86 -- and the initialization code will be portable.
88 Abort_Task_Interrupt : Interrupt_ID;
89 -- The interrupt that is used to implement task abortion,
90 -- if an interrupt is used for that purpose.
91 -- This is one of the reserved interrupts.
93 Keep_Unmasked : Interrupt_Set := (others => False);
94 -- Keep_Unmasked (I) is true iff the interrupt I is
95 -- one that must be kept unmasked at all times,
96 -- except (perhaps) for short critical sections.
97 -- This includes interrupts that are mapped to exceptions
98 -- (see System.Interrupt_Exceptions.Is_Exception), but may also
99 -- include interrupts (e.g. timer) that need to be kept unmasked
100 -- for other reasons.
101 -- Where interrupts are implemented as OS signals, and signal masking
102 -- is per-task, the interrupt should be unmasked in ALL TASKS.
104 Reserve : Interrupt_Set := (others => False);
105 -- Reserve (I) is true iff the interrupt I is one that
106 -- cannot be permitted to be attached to a user handler.
107 -- The possible reasons are many. For example,
108 -- it may be mapped to an exception, used to implement task abortion,
109 -- or used to implement time delays.
111 Keep_Masked : Interrupt_Set := (others => False);
112 -- Keep_Masked (I) is true iff the interrupt I must always be masked.
113 -- Where interrupts are implemented as OS signals, and signal masking
114 -- is per-task, the interrupt should be masked in ALL TASKS.
115 -- There might not be any interrupts in this class, depending on
116 -- the environment. For example, if interrupts are OS signals
117 -- and signal masking is per-task, use of the sigwait operation
118 -- requires the signal be masked in all tasks.
120 procedure Initialize_Interrupts;
121 -- On systems where there is no signal inheritance between tasks (e.g
122 -- VxWorks, GNU/LinuxThreads), this procedure is used to initialize
123 -- interrupts handling in each task. Otherwise this function should
124 -- only be called by initialize in this package body.
126 private
128 use type System.OS_Interface.unsigned_long;
130 type Interrupt_Mask is new System.OS_Interface.sigset_t;
132 -- Interrupts on VMS are implemented with a mailbox. A QIO read is
133 -- registered on the Rcv channel and the interrupt occurs by registering
134 -- a QIO write on the Snd channel. The maximum number of pending
135 -- interrupts is arbitrarily set at 1000. One nice feature of using
136 -- a mailbox is that it is trivially extendable to cross process
137 -- interrupts.
139 Rcv_Interrupt_Chan : System.OS_Interface.unsigned_short := 0;
140 Snd_Interrupt_Chan : System.OS_Interface.unsigned_short := 0;
141 Interrupt_Mailbox : Interrupt_ID := 0;
142 Interrupt_Bufquo : System.OS_Interface.unsigned_long
143 := 1000 * (Interrupt_ID'Size / 8);
145 end System.Interrupt_Management;