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