source: rtems/doc/supplements/i386/intr.t @ ae68ff0

4.104.114.84.95
Last change on this file since ae68ff0 was ae68ff0, checked in by Joel Sherrill <joel.sherrill@…>, on 05/27/97 at 12:40:11

Initial revision

  • Property mode set to 100644
File size: 7.2 KB
Line 
1@ifinfo
2@node Interrupt Processing, Interrupt Processing Introduction, Memory Model Flat Memory Model, Top
3@end ifinfo
4@chapter Interrupt Processing
5@ifinfo
6@menu
7* Interrupt Processing Introduction::
8* Interrupt Processing Vectoring of Interrupt Handler::
9* Interrupt Processing Interrupt Stack Frame::
10* Interrupt Processing Interrupt Levels::
11* Interrupt Processing Disabling of Interrupts by RTEMS::
12* Interrupt Processing Interrupt Stack::
13@end menu
14@end ifinfo
15
16@ifinfo
17@node Interrupt Processing Introduction, Interrupt Processing Vectoring of Interrupt Handler, Interrupt Processing, Interrupt Processing
18@end ifinfo
19@section Introduction
20
21Different types of processors respond to the
22occurrence of an interrupt in their own unique fashion. In
23addition, each processor type provides a control mechanism to
24allow the proper handling of an interrupt.  The processor
25dependent response to the interrupt modifies the execution state
26and results in the modification of the execution stream. This
27modification usually requires that an interrupt handler utilize
28the provided control mechanisms to return to the normal
29processing stream.  Although RTEMS hides many of the processor
30dependent details of interrupt processing, it is important to
31understand how the RTEMS interrupt manager is mapped onto the
32processor's unique architecture. Discussed in this chapter are
33the the processor's response and control mechanisms as they
34pertain to RTEMS.
35
36@ifinfo
37@node Interrupt Processing Vectoring of Interrupt Handler, Interrupt Processing Interrupt Stack Frame, Interrupt Processing Introduction, Interrupt Processing
38@end ifinfo
39@section Vectoring of Interrupt Handler
40
41Although the i386 supports multiple privilege levels,
42RTEMS and all user software executes at privilege level 0.  This
43decision was made by the RTEMS designers to enhance
44compatibility with processors which do not provide sophisticated
45protection facilities like those of the i386.  This decision
46greatly simplifies the discussion of i386 processing, as one
47need only consider interrupts without privilege transitions.
48
49Upon receipt of an interrupt  the i386 automatically
50performs the following actions:
51
52@itemize @bullet
53@item pushes the EFLAGS register
54
55@item pushes the far address of the interrupted instruction
56
57@item vectors to the interrupt service routine (ISR).
58@end itemize
59
60A nested interrupt is processed similarly by the
61i386.
62
63@ifinfo
64@node Interrupt Processing Interrupt Stack Frame, Interrupt Processing Interrupt Levels, Interrupt Processing Vectoring of Interrupt Handler, Interrupt Processing
65@end ifinfo
66@section Interrupt Stack Frame
67
68The structure of the Interrupt Stack Frame for the
69i386 which is placed on the interrupt stack by the processor in
70response to an interrupt is as follows:
71
72@ifset use-ascii
73@example
74@group
75               +----------------------+
76               | Old EFLAGS Register  | ESP+8
77               +----------+-----------+
78               |   UNUSED |  Old CS   | ESP+4
79               +----------+-----------+
80               |       Old EIP        | ESP
81               +----------------------+
82@end group
83@end example
84@end ifset
85
86@ifset use-tex
87@sp 1
88@tex
89\centerline{\vbox{\offinterlineskip\halign{
90\strut\vrule#&
91\hbox to 1.00in{\enskip\hfil#\hfil}&
92\vrule#&
93\hbox to 1.00in{\enskip\hfil#\hfil}&
94\vrule#&
95\hbox to 0.75in{\enskip\hfil#\hfil}
96\cr
97\multispan{4}\hrulefill\cr
98& \multispan{3} Old EFLAGS Register\quad&&ESP+8\cr
99\multispan{4}\hrulefill\cr
100&UNUSED &&Old CS &&ESP+4\cr
101\multispan{4}\hrulefill\cr
102& \multispan{3} Old EIP && ESP\cr
103\multispan{4}\hrulefill\cr
104}}\hfil}
105@end tex
106@end ifset
107 
108@ifset use-html
109@html
110<CENTER>
111  <TABLE COLS=3 WIDTH="40%" BORDER=2>
112<TR><TD ALIGN=center COLSPAN=2><STRONG>Old EFLAGS Register</STRONG></TD>
113    <TD ALIGN=center>0x0</TD></TR>
114<TR><TD ALIGN=center><STRONG>UNUSED</STRONG></TD>
115    <TD ALIGN=center><STRONG>Old CS</STRONG></TD>
116    <TD ALIGN=center>0x2</TD></TR>
117<TR><TD ALIGN=center COLSPAN=2><STRONG>Old EIP</STRONG></TD>
118    <TD ALIGN=center>0x4</TD></TR>
119  </TABLE>
120</CENTER>
121@end html
122@end ifset
123
124@ifinfo
125@node Interrupt Processing Interrupt Levels, Interrupt Processing Disabling of Interrupts by RTEMS, Interrupt Processing Interrupt Stack Frame, Interrupt Processing
126@end ifinfo
127@section Interrupt Levels
128
129Although RTEMS supports 256 interrupt levels, the
130i386 only supports two -- enabled and disabled.  Interrupts are
131enabled when the interrupt-enable flag (IF) in the extended
132flags (EFLAGS) is set.  Conversely, interrupt processing is
133inhibited when the IF is cleared.  During a non-maskable
134interrupt, all other interrupts, including other non-maskable
135ones, are inhibited.
136
137RTEMS interrupt levels 0 and 1 such that level zero
138(0) indicates that interrupts are fully enabled and level one
139that interrupts are disabled.  All other RTEMS interrupt levels
140are undefined and their behavior is unpredictable.
141
142@ifinfo
143@node Interrupt Processing Disabling of Interrupts by RTEMS, Interrupt Processing Interrupt Stack, Interrupt Processing Interrupt Levels, Interrupt Processing
144@end ifinfo
145@section Disabling of Interrupts by RTEMS
146
147During the execution of directive calls, critical
148sections of code may be executed.  When these sections are
149encountered, RTEMS disables interrupts before the execution of
150this section and restores them to the previous level upon
151completion of the section.  RTEMS has been optimized to insure
152that interrupts are disabled for less than RTEMS_MAXIMUM_DISABLE_PERIOD
153microseconds on a RTEMS_MAXIMUM_DISABLE_PERIOD_MHZ Mhz i386 with zero
154wait states.  These numbers will vary based the number of wait states
155and processor speed present on the target board.   [NOTE:  The maximum
156period with interrupts disabled within RTEMS was last calculated for
157Release RTEMS_RELEASE_FOR_MAXIMUM_DISABLE_PERIOD.]
158
159Non-maskable interrupts (NMI) cannot be disabled, and
160ISRs which execute at this level MUST NEVER issue RTEMS system
161calls.  If a directive is invoked, unpredictable results may
162occur due to the inability of RTEMS to protect its critical
163sections.  However, ISRs that make no system calls may safely
164execute as non-maskable interrupts.
165
166@ifinfo
167@node Interrupt Processing Interrupt Stack, Default Fatal Error Processing, Interrupt Processing Disabling of Interrupts by RTEMS, Interrupt Processing
168@end ifinfo
169@section Interrupt Stack
170
171The i386 family does not support a dedicated hardware
172interrupt stack.  On this processor, RTEMS allocates and manages
173a dedicated interrupt stack.  As part of vectoring a non-nested
174interrupt service routine, RTEMS switches from the stack of the
175interrupted task to a dedicated interrupt stack.  When a
176non-nested interrupt returns, RTEMS switches back to the stack
177of the interrupted stack.  The current stack pointer is not
178altered by RTEMS on nested interrupt.
179
180Without a dedicated interrupt stack, every task in
181the system MUST have enough stack space to accommodate the worst
182case stack usage of that particular task and the interrupt
183service routines COMBINED.  By supporting a dedicated interrupt
184stack, RTEMS significantly lowers the stack requirements for
185each task.
186
187RTEMS allocates the dedicated interrupt stack from
188the Workspace Area.  The amount of memory allocated for the
189interrupt stack is determined by the interrupt_stack_size field
190in the CPU Configuration Table.
191
Note: See TracBrowser for help on using the repository browser.