annotate gcc/ada/libgnarl/s-intman.ads @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
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 --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
9 -- Copyright (C) 1992-2019, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNARL is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
kono
parents:
diff changeset
17 -- --
kono
parents:
diff changeset
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
kono
parents:
diff changeset
19 -- additional permissions described in the GCC Runtime Library Exception, --
kono
parents:
diff changeset
20 -- version 3.1, as published by the Free Software Foundation. --
kono
parents:
diff changeset
21 -- --
kono
parents:
diff changeset
22 -- You should have received a copy of the GNU General Public License and --
kono
parents:
diff changeset
23 -- a copy of the GCC Runtime Library Exception along with this program; --
kono
parents:
diff changeset
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
kono
parents:
diff changeset
25 -- <http://www.gnu.org/licenses/>. --
kono
parents:
diff changeset
26 -- --
kono
parents:
diff changeset
27 -- GNARL was developed by the GNARL team at Florida State University. --
kono
parents:
diff changeset
28 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
kono
parents:
diff changeset
29 -- --
kono
parents:
diff changeset
30 ------------------------------------------------------------------------------
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 -- This package encapsulates and centralizes information about all uses of
kono
parents:
diff changeset
33 -- interrupts (or signals), including the target-dependent mapping of
kono
parents:
diff changeset
34 -- interrupts (or signals) to exceptions.
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 -- Unlike the original design, System.Interrupt_Management can only be used
kono
parents:
diff changeset
37 -- for tasking systems.
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 -- PLEASE DO NOT put any subprogram declarations with arguments of type
kono
parents:
diff changeset
40 -- Interrupt_ID into the visible part of this package. The type Interrupt_ID
kono
parents:
diff changeset
41 -- is used to derive the type in Ada.Interrupts, and adding more operations
kono
parents:
diff changeset
42 -- to that type would be illegal according to the Ada Reference Manual. This
kono
parents:
diff changeset
43 -- is the reason why the signals sets are implemented using visible arrays
kono
parents:
diff changeset
44 -- rather than functions.
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 with System.OS_Interface;
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 with Interfaces.C;
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 package System.Interrupt_Management is
kono
parents:
diff changeset
51 pragma Preelaborate;
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 type Interrupt_Mask is limited private;
kono
parents:
diff changeset
54
kono
parents:
diff changeset
55 type Interrupt_ID is new Interfaces.C.int
kono
parents:
diff changeset
56 range 0 .. System.OS_Interface.Max_Interrupt;
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 type Interrupt_Set is array (Interrupt_ID) of Boolean;
kono
parents:
diff changeset
59
kono
parents:
diff changeset
60 -- The following objects serve as constants, but are initialized in the
kono
parents:
diff changeset
61 -- body to aid portability. This permits us to use more portable names for
kono
parents:
diff changeset
62 -- interrupts, where distinct names may map to the same interrupt ID
kono
parents:
diff changeset
63 -- value.
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 -- For example, suppose SIGRARE is a signal that is not defined on all
kono
parents:
diff changeset
66 -- systems, but is always reserved when it is defined. If we have the
kono
parents:
diff changeset
67 -- convention that ID zero is not used for any "real" signals, and SIGRARE
kono
parents:
diff changeset
68 -- = 0 when SIGRARE is not one of the locally supported signals, we can
kono
parents:
diff changeset
69 -- write:
kono
parents:
diff changeset
70 -- Reserved (SIGRARE) := True;
kono
parents:
diff changeset
71 -- and the initialization code will be portable.
kono
parents:
diff changeset
72
kono
parents:
diff changeset
73 Abort_Task_Interrupt : Interrupt_ID;
kono
parents:
diff changeset
74 -- The interrupt that is used to implement task abort if an interrupt is
kono
parents:
diff changeset
75 -- used for that purpose. This is one of the reserved interrupts.
kono
parents:
diff changeset
76
kono
parents:
diff changeset
77 Keep_Unmasked : Interrupt_Set := (others => False);
kono
parents:
diff changeset
78 -- Keep_Unmasked (I) is true iff the interrupt I is one that must be kept
kono
parents:
diff changeset
79 -- unmasked at all times, except (perhaps) for short critical sections.
kono
parents:
diff changeset
80 -- This includes interrupts that are mapped to exceptions (see
kono
parents:
diff changeset
81 -- System.Interrupt_Exceptions.Is_Exception), but may also include
kono
parents:
diff changeset
82 -- interrupts (e.g. timer) that need to be kept unmasked for other
kono
parents:
diff changeset
83 -- reasons. Where interrupts are implemented as OS signals, and signal
kono
parents:
diff changeset
84 -- masking is per-task, the interrupt should be unmasked in ALL TASKS.
kono
parents:
diff changeset
85
kono
parents:
diff changeset
86 Reserve : Interrupt_Set := (others => False);
kono
parents:
diff changeset
87 -- Reserve (I) is true iff the interrupt I is one that cannot be permitted
kono
parents:
diff changeset
88 -- to be attached to a user handler. The possible reasons are many. For
kono
parents:
diff changeset
89 -- example, it may be mapped to an exception used to implement task abort,
kono
parents:
diff changeset
90 -- or used to implement time delays.
kono
parents:
diff changeset
91
kono
parents:
diff changeset
92 procedure Initialize;
kono
parents:
diff changeset
93 -- Initialize the various variables defined in this package. This procedure
kono
parents:
diff changeset
94 -- must be called before accessing any object from this package, and can be
kono
parents:
diff changeset
95 -- called multiple times.
kono
parents:
diff changeset
96
kono
parents:
diff changeset
97 private
kono
parents:
diff changeset
98 type Interrupt_Mask is new System.OS_Interface.sigset_t;
kono
parents:
diff changeset
99 -- In some implementations Interrupt_Mask is represented as a linked list
kono
parents:
diff changeset
100
kono
parents:
diff changeset
101 procedure Adjust_Context_For_Raise
kono
parents:
diff changeset
102 (Signo : System.OS_Interface.Signal;
kono
parents:
diff changeset
103 Ucontext : System.Address);
kono
parents:
diff changeset
104 pragma Import
kono
parents:
diff changeset
105 (C, Adjust_Context_For_Raise, "__gnat_adjust_context_for_raise");
kono
parents:
diff changeset
106 -- Target specific hook performing adjustments to the signal's machine
kono
parents:
diff changeset
107 -- context, to be called before an exception may be raised from a signal
kono
parents:
diff changeset
108 -- handler. This service is provided by init.c, together with the
kono
parents:
diff changeset
109 -- non-tasking signal handler.
kono
parents:
diff changeset
110
kono
parents:
diff changeset
111 end System.Interrupt_Management;