source: rtems/doc/supplements/hppa1_1/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: 8.8 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 External Interrupts and Traps::
11* Interrupt Processing Interrupt Levels::
12* Interrupt Processing Disabling of Interrupts by RTEMS::
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
22occurence of an interrupt in their own unique fashion. In
23addition, each processor type provides a control mechanism to
24allow for the proper handling of an interrupt.  The processor
25dependent response to the interrupt modifies the current
26execution state and results in a change in the execution stream.
27Most processors require that an interrupt handler utilize some
28special control mechanisms to return to the normal processing
29stream.  Although RTEMS hides many of the processor dependent
30details of interrupt processing, it is important to understand
31how the RTEMS interrupt manager is mapped onto the processor's
32unique architecture. Discussed in this chapter are the PA-RISC's
33interrupt response and control mechanisms as they pertain to
34RTEMS.
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
41Upon receipt of an interrupt the PA-RISC
42automatically performs the following actions:
43
44@itemize @bullet
45@item The PSW (Program Status Word) is saved in the IPSW
46(Interrupt Program Status Word).
47
48@item The current privilege level is set to 0.
49
50@item The following defined bits in the PSW are set:
51
52@item E bit is set to the default endian bit
53
54@item M bit is set to 1 if the interrupt is a high-priority
55machine check and 0 otherwise
56
57@item Q bit is set to zero thuse freezing the IIA
58(Instruction Address) queues
59
60@item C and D bits are set to zero thus disabling all
61protection and translation.
62
63@item I bit is set to zero this disabling all external,
64powerfail, and low-priority machine check interrupts.
65
66@item All others bits are set to zero.
67
68@item General purpose registers r1, r8, r9, r16, r17, r24, and
69r25 are copied to the shadow registers.
70
71@item Execution begins at the address given by the formula:
72Interruption Vector Address + (32 * interrupt vector number).
73@end itemize
74
75Once the processor has completed the actions it is is
76required to perform for each interrupt, the  RTEMS interrupt
77management code (the beginning of which is stored in the
78Interruption Vector Table) gains control and performs the
79following actions upon each interrupt:
80
81@itemize @bullet
82@item returns the processor to "virtual mode" thus reenabling
83all code and data address translation.
84
85@item saves all necessary interrupt state information
86
87@item saves all floating point registers
88
89@item saves all integer registers
90
91@item switches the current stack to the interrupt stack
92
93@item dispatches to the appropriate user provided interrupt
94service routine (ISR).  If the ISR was installed with the
95interrupt_catch directive, then it will be executed at this.
96Because, the RTEMS interrupt handler saves all registers which
97are not preserved according to the calling conventions and
98invokes the application's ISR, the ISR can easily be written in
99a high-level language.
100@end itemize
101
102RTEMS refers to the combination of the interrupt
103state information and registers saved when vectoring an
104interrupt as the Interrupt Stack Frame (ISF).  A nested
105interrupt is processed similarly by the PA-RISC and RTEMS with
106the exception that the nested interrupt occurred while executing
107on the interrupt stack and, thus, the current stack need not be
108switched.
109
110@ifinfo
111@node Interrupt Processing Interrupt Stack Frame, Interrupt Processing External Interrupts and Traps, Interrupt Processing Vectoring of Interrupt Handler, Interrupt Processing
112@end ifinfo
113@section Interrupt Stack Frame
114
115The PA-RISC architecture does not alter the stack
116while processing interrupts.  However, RTEMS does save
117information on the stack as part of processing an interrupt.
118This following shows the format of the Interrupt Stack Frame for
119the PA-RISC as defined by RTEMS:
120
121@example
122@group
123               +------------------------+
124               |    Interrupt Context   | 0xXXX
125               +------------------------+
126               |     Integer Context    | 0xXXX
127               +------------------------+
128               | Floating Point Context | 0xXXX
129               +------------------------+
130@end group
131@end example
132
133@ifinfo
134@node Interrupt Processing External Interrupts and Traps, Interrupt Processing Interrupt Levels, Interrupt Processing Interrupt Stack Frame, Interrupt Processing
135@end ifinfo
136@section External Interrupts and Traps
137
138In addition to the thirty-two unique interrupt
139sources supported by the PA-RISC architecture, RTEMS also
140supports the installation of handlers for each of the thirty-two
141external interrupts supported by the PA-RISC architecture.
142Except for interrupt vector 4, each of the interrupt vectors 0
143through 31 may be associated with a user-provided interrupt
144handler.  Interrupt vector 4 is used for external interrupts.
145When an external interrupt occurs, the RTEMS external interrupt
146handler is invoked and the actual interrupt source is indicated
147by status bits in the EIR (External Interrupt Request) register.
148The RTEMS external interrupt handler (or interrupt vector four)
149examines the EIR to determine which interrupt source requires
150servicing.
151
152RTEMS supports sixty-four interrupt vectors for the
153PA-RISC.  Vectors 0 through 31 map to the normal interrupt
154sources while RTEMS interrupt vectors 32 through 63 are directly
155associated with the external interrupt sources indicated by bits
1560 through 31 in the EIR.
157
158The exact set of interrupt sources which are checked
159for by the RTEMS external interrupt handler and the order in
160which they are checked are configured by the user in the CPU
161Configuration Table.  If an external interrupt occurs which does
162not have a handler configured, then the spurious interrupt
163handler will be invoked.  The spurious interrupt handler may
164also be specifiec by the user in the CPU Configuration Table.
165
166@ifinfo
167@node Interrupt Processing Interrupt Levels, Interrupt Processing Disabling of Interrupts by RTEMS, Interrupt Processing External Interrupts and Traps, Interrupt Processing
168@end ifinfo
169@section Interrupt Levels
170
171Two levels (enabled and disabled) of interrupt
172priorities are supported by the PA-RISC architecture.  Level
173zero (0) indicates that interrupts are fully enabled (i.e. the I
174bit of the PSW is 1).  Level one (1) indicates that interrupts
175are disabled (i.e. the I bit of the PSW is 0).  Thirty-two
176independent sources of external interrupts are supported by the
177PA-RISC architecture.  Each of these interrupts sources may be
178individually enabled or disabled.  When processor interrupts are
179disabled, all sources of external interrupts are ignored.  When
180processor interrupts are enabled, the EIR (External Interrupt
181Request) register is used to determine which sources are
182currently allowed to generate interrupts.
183
184Although RTEMS supports 256 interrupt levels, the
185PA-RISC architecture only supports two.  RTEMS interrupt level 0
186indicates that interrupts are enabled and level 1 indicates that
187interrupts are disabled.  All other RTEMS interrupt levels are
188undefined and their behavior is unpredictable.
189
190@ifinfo
191@node Interrupt Processing Disabling of Interrupts by RTEMS, Default Fatal Error Processing, Interrupt Processing Interrupt Levels, Interrupt Processing
192@end ifinfo
193@section Disabling of Interrupts by RTEMS
194
195During the execution of directive calls, critical
196sections of code may be executed.  When these sections are
197encountered, RTEMS disables external interrupts by setting the I
198bit in the PSW to 0 before the execution of this section and
199restores them to the previous level upon completion of the
200section.  RTEMS has been optimized to insure that interrupts are
201disabled for less than XXX instructions when compiled with GNU
202CC at optimization level 4.  The exact execution time will vary
203based on the based on the processor implementation, amount of
204cache, the number of wait states for primary memory, and
205processor speed present on the target board.
206
207Non-maskable interrupts (NMI) such as high-priority
208machine checks cannot be disabled, and ISRs which execute at
209this level MUST NEVER issue RTEMS system calls.  If a directive
210is invoked, unpredictable results may occur due to the inability
211of RTEMS to protect its critical sections.  However, ISRs that
212make no system calls may safely execute as non-maskable
213interrupts.
214
Note: See TracBrowser for help on using the repository browser.