File: AA-C-3.html

package info (click to toggle)
ada-reference-manual 20021112web-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny, sarge
  • size: 18,652 kB
  • ctags: 8,921
  • sloc: makefile: 52; sh: 20
file content (259 lines) | stat: -rw-r--r-- 18,307 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
    <TITLE>AARM95 - Interrupt Support</TITLE>
    <META NAME="Author" CONTENT="JTC1/SC22/WG9/ARG, by Randall Brukardt, ARG Editor">
    <META NAME="GENERATOR" CONTENT="Arm_Form.Exe, Ada Reference Manual generator">
    <STYLE type="text/css">
    DIV.paranum {position: absolute; font-family: Arial, Helvetica, sans-serif; left: 0.5 em; top: auto}
    TT {font-family: "Courier New", monospace}
    DT {display: compact}
    DIV.Normal {font-family: "Times New Roman", Times, serif; margin-bottom: 0.6em}
    DIV.Wide {font-family: "Times New Roman", Times, serif; margin-top: 0.6em; margin-bottom: 0.6em}
    DIV.Annotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
    DIV.WideAnnotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0.6em; margin-bottom: 0.6em}
    DIV.Index {font-family: "Times New Roman", Times, serif}
    DIV.SyntaxSummary {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
    DIV.Notes {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.6em}
    DIV.NotesHeader {font-family: "Times New Roman", Times, serif; margin-left: 2.0em}
    DIV.SyntaxIndented {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
    DIV.Indented {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-bottom: 0.6em}
    DIV.CodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
    DIV.SmallIndented {font-family: "Times New Roman", Times, serif; margin-left:  10.0em; margin-bottom: 0.6em}
    DIV.SmallCodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-bottom: 0.6em}
    DIV.Examples {font-family: "Courier New", monospace; margin-left: 2.0em; margin-bottom: 0.6em}
    DIV.SmallExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left: 7.5em; margin-bottom: 0.6em}
    DIV.IndentedExamples {font-family: "Courier New", monospace; margin-left: 8.0em; margin-bottom: 0.6em}
    DIV.SmallIndentedExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left:  15.0em; margin-bottom: 0.6em}
    UL.Bulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SmallBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SmallNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.IndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.CodeIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.CodeIndentedNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SyntaxIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NotesBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NotesNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    DL.Hanging {font-family: "Times New Roman", Times, serif; margin-top: 0em; margin-bottom: 0.6em}
    DD.Hanging {margin-left: 6.0em}
    DL.IndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.IndentedHanging {margin-left: 2.0em}
    DL.HangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.HangingInBulleted {margin-left: 4.0em}
    DL.SmallHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.SmallHanging {margin-left: 7.5em}
    DL.SmallIndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.SmallIndentedHanging {margin-left: 2.0em}
    DL.SmallHangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.SmallHangingInBulleted {margin-left: 5.0em}
    DL.Enumerated {font-family: "Times New Roman", Times, serif; margin-right: 0.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.Enumerated {margin-left: 2.0em}
    DL.SmallEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.SmallEnumerated {margin-left: 2.5em}
    DL.NestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    DL.SmallNestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    </STYLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFF0" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<P><A HREF="AA-TOC.html">Contents</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-0-29.html">Index</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-C-2.html">Previous</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-C-3-1.html">Next</A></P>
<HR>
<H1> C.3 Interrupt Support</H1>
<DIV Class="Paranum"><FONT SIZE=-2>1</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;[This clause specifies the language-defined model
for hardware interrupts in addition to mechanisms for handling interrupts.]
<A NAME="I6630"></A></DIV>

<H4 ALIGN=CENTER>Dynamic Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>2</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;<A NAME="I6631"></A>[An <I>interrupt</I> represents
a class of events that are detected by the hardware or the system software.]
<A NAME="I6632"></A>Interrupts are said to occur. An <I>occurrence</I>
of an interrupt is separable into generation and delivery. <A NAME="I6633"></A><I>Generation</I>
of an interrupt is the event in the underlying hardware or system that
makes the interrupt available to the program. <A NAME="I6634"></A><I>Delivery</I>
is the action that invokes part of the program as response to the interrupt
occurrence. <A NAME="I6635"></A>Between generation and delivery, the
interrupt occurrence [(or interrupt)] is <I>pending</I>. <A NAME="I6636"></A>Some
or all interrupts may be <I>blocked</I>. When an interrupt is blocked,
all occurrences of that interrupt are prevented from being delivered.
<A NAME="I6637"></A><A NAME="I6638"></A>Certain interrupts are <I>reserved</I>.
The set of reserved interrupts is implementation defined. A reserved
interrupt is either an interrupt for which user-defined handlers are
not supported, or one which already has an attached handler by some other
implementation-defined means. <A NAME="I6639"></A>Program units can be
connected to non-reserved interrupts. While connected, the program unit
is said to be <I>attached</I> to that interrupt. The execution of that
program unit, the <I>interrupt handler</I>, is invoked upon delivery
of the interrupt occurrence. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>2.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation defined: </B>Implementation-defined
aspects of interrupts.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>2.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>To be honest: </B>As an obsolescent
feature, interrupts may be attached to task entries by an address clause.
See <A HREF="AA-J-7-1.html">J.7.1</A>. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>3</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;While a handler is attached to an interrupt, it
is called once for each delivered occurrence of that interrupt. While
the handler executes, the corresponding interrupt is blocked.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;While an interrupt is blocked, all occurrences
of that interrupt are prevented from being delivered. Whether such occurrences
remain pending or are lost is implementation defined.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;<A NAME="I6640"></A>Each interrupt has a <I>default
treatment</I> which determines the system's response to an occurrence
of that interrupt when no user-defined handler is attached. The set of
possible default treatments is implementation defined, as is the method
(if one exists) for configuring the default treatments for interrupts.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;An interrupt is delivered to the handler (or default
treatment) that is in effect for that interrupt at the time of delivery.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;An exception propagated from a handler that is
invoked by an interrupt has no effect.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;[If the Ceiling_Locking policy (see <A HREF="AA-D-3.html">D.3</A>)
is in effect, the interrupt handler executes with the active priority
that is the ceiling priority of the corresponding protected object.]</DIV>

<H4 ALIGN=CENTER>Implementation Requirements</H4>
<DIV Class="Paranum"><FONT SIZE=-2>9</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;The implementation shall provide a mechanism to
determine the minimum stack space that is needed for each interrupt handler
and to reserve that space for the execution of the handler. [This space
should accommodate nested invocations of the handler where the system
permits this.]</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>10</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;If the hardware or the underlying system holds
pending interrupt occurrences, the implementation shall provide for later
delivery of these occurrences to the program.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;If the Ceiling_Locking policy is not in effect,
the implementation shall provide means for the application to specify
whether interrupts are to be blocked during protected actions.</DIV>

<H4 ALIGN=CENTER>Documentation Requirements</H4>
<DIV Class="Paranum"><FONT SIZE=-2>12</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;&nbsp;The implementation
shall document the following items: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>12.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>This information
may be different for different forms of interrupt handlers. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>13</FONT></DIV>
<DL Class="Enumerated"><DT>&nbsp;&nbsp;&nbsp;&nbsp;1.<DD Class="Enumerated">
For each interrupt, which interrupts are blocked from delivery when a
handler attached to that interrupt executes (either as a result of an
interrupt delivery or of an ordinary call on a procedure of the corresponding
protected object).</DL>
<DIV Class="Paranum"><FONT SIZE=-2>14</FONT></DIV>
<DL Class="Enumerated"><DT>&nbsp;&nbsp;&nbsp;&nbsp;2.<DD Class="Enumerated">
Any interrupts that cannot be blocked, and the effect of attaching handlers
to such interrupts, if this is permitted.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>15</FONT></DIV>
<DL Class="Enumerated"><DT>&nbsp;&nbsp;&nbsp;&nbsp;3.<DD Class="Enumerated">
Which run-time stack an interrupt handler uses when it executes as a
result of an interrupt delivery; if this is configurable, what is the
mechanism to do so; how to specify how much space to reserve on that
stack.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>16</FONT></DIV>
<DL Class="Enumerated"><DT>&nbsp;&nbsp;&nbsp;&nbsp;4.<DD Class="Enumerated">
Any implementation- or hardware-specific activity that happens before
a user-defined interrupt handler gets control (e.g., reading device registers,
acknowledging devices).</DL>
<DIV Class="Paranum"><FONT SIZE=-2>17</FONT></DIV>
<DL Class="Enumerated"><DT>&nbsp;&nbsp;&nbsp;&nbsp;5.<DD Class="Enumerated">
Any timing or other limitations imposed on the execution of interrupt
handlers.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>18</FONT></DIV>
<DL Class="Enumerated"><DT>&nbsp;&nbsp;&nbsp;&nbsp;6.<DD Class="Enumerated">
The state (blocked/unblocked) of the non-reserved interrupts when the
program starts; if some interrupts are unblocked, what is the mechanism
a program can use to protect itself before it can attach the corresponding
handlers.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>19</FONT></DIV>
<DL Class="Enumerated"><DT>&nbsp;&nbsp;&nbsp;&nbsp;7.<DD Class="Enumerated">
Whether the interrupted task is allowed to resume execution before the
interrupt handler returns.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>20</FONT></DIV>
<DL Class="Enumerated"><DT>&nbsp;&nbsp;&nbsp;&nbsp;8.<DD Class="Enumerated">
The treatment of interrupt occurrences that are generated while the interrupt
is blocked; i.e., whether one or more occurrences are held for later
delivery, or all are lost.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>21</FONT></DIV>
<DL Class="Enumerated"><DT>&nbsp;&nbsp;&nbsp;&nbsp;9.<DD Class="Enumerated">
Whether predefined or implementation-defined exceptions are raised as
a result of the occurrence of any interrupt, and the mapping between
the machine interrupts (or traps) and the predefined exceptions.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>22</FONT></DIV>
<DL Class="Enumerated"><DT>&nbsp;&nbsp;&nbsp;&nbsp;10.<DD Class="Enumerated">
On a multi-processor, the rules governing the delivery of an interrupt
to a particular processor. </DL>

<H4 ALIGN=CENTER>Implementation Permissions</H4>
<DIV Class="Paranum"><FONT SIZE=-2>23</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;If the underlying system or hardware does not
allow interrupts to be blocked, then no blocking is required [as part
of the execution of subprograms of a protected object whose one of its
subprograms is an interrupt handler].</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;In a multi-processor with more than one interrupt
subsystem, it is implementation defined whether (and how) interrupt sources
from separate subsystems share the same Interrupt_ID type (see <A HREF="AA-C-3-2.html">C.3.2</A>).
In particular, the meaning of a blocked or pending interrupt may then
be applicable to one processor only. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>This issue
is tightly related to the issue of scheduling on a multi-processor. In
a sense, if a particular interrupt source is not available to all processors,
the system is not truly homogeneous.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>One way to approach this problem
is to assign sub-ranges within Interrupt_ID to each interrupt subsystem,
such that ``similar'' interrupt sources (e.g. a timer) in different subsystems
get a distinct id. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>25</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;Implementations are allowed to impose timing
or other limitations on the execution of interrupt handlers. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>25.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>These limitations
are often necessary to ensure proper behavior of the implementation.
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>26</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;Other forms of handlers are allowed to be supported,
in which case, the rules of this subclause should be adhered to.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>27</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;The active priority of the execution of an interrupt
handler is allowed to vary from one occurrence of the same interrupt
to another.</DIV>

<H4 ALIGN=CENTER>Implementation Advice</H4>
<DIV Class="Paranum"><FONT SIZE=-2>28</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;If the Ceiling_Locking policy is not in effect,
the implementation should provide means for the application to specify
which interrupts are to be blocked during protected actions, if the underlying
system allows for a finer-grain control of interrupt blocking.</DIV>
<DIV Class="NotesHeader"><FONT SIZE=-1>NOTES</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>29</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>1&nbsp;&nbsp;The default treatment for
an interrupt can be to keep the interrupt pending or to deliver it to
an implementation-defined handler. Examples of actions that an implementation-defined
handler is allowed to perform include aborting the partition, ignoring
(i.e., discarding occurrences of) the interrupt, or queuing one or more
occurrences of the interrupt for possible later delivery when a user-defined
handler is attached to that interrupt.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>30</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>2&nbsp;&nbsp;It is a bounded error to
call Task_Identification.Current_Task (see <A HREF="AA-C-7-1.html">C.7.1</A>)
from an interrupt handler.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>31</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>3&nbsp;&nbsp;The rule that an exception
propagated from an interrupt handler has no effect is modeled after the
rule about exceptions propagated out of task bodies.</FONT></DIV>

<HR>
<P><A HREF="AA-TOC.html">Contents</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-0-29.html">Index</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-C-2.html">Previous</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-C-3-1.html">Next</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-TTL.html">Legal</A></P>
</BODY>
</HTML>