source: rtems/doc/supplements/powerpc/intr_NOTIMES.t @ 0660b4f8

4.104.114.84.95
Last change on this file since 0660b4f8 was 0660b4f8, checked in by Joel Sherrill <joel.sherrill@…>, on 11/16/99 at 19:50:56

Changed copyright date to 1999.

  • Property mode set to 100644
File size: 7.2 KB
Line 
1@c
2@c  COPYRIGHT (c) 1988-1999.
3@c  On-Line Applications Research Corporation (OAR).
4@c  All rights reserved.
5@c
6@c  $Id$
7@c
8
9@chapter Interrupt Processing
10
11@section Introduction
12
13Different types of processors respond to the
14occurrence of an interrupt in its own unique fashion. In
15addition, each processor type provides a control mechanism to
16allow for the proper handling of an interrupt.  The processor
17dependent response to the interrupt modifies the current
18execution state and results in a change in the execution stream.
19Most processors require that an interrupt handler utilize some
20special control mechanisms to return to the normal processing
21stream.  Although RTEMS hides many of the processor dependent
22details of interrupt processing, it is important to understand
23how the RTEMS interrupt manager is mapped onto the processor's
24unique architecture. Discussed in this chapter are the PowerPC's
25interrupt response and control mechanisms as they pertain to
26RTEMS.
27
28RTEMS and associated documentation uses the terms
29interrupt and vector.  In the PowerPC architecture, these terms
30correspond to exception and exception handler, respectively.  The terms will
31be used interchangeably in this manual.
32
33@section Synchronous Versus Asynchronous Exceptions
34
35In the PowerPC architecture exceptions can be either precise or
36imprecise and either synchronous or asynchronous.  Asynchronous
37exceptions occur when an external event interrupts the processor.
38Synchronous exceptions are caused by the actions of an
39instruction. During an exception SRR0 is used to calculate where
40instruction processing should resume.  All instructions prior to
41the resume instruction will have completed execution.  SRR1 is used to
42store the machine status.
43
44There are two asynchronous nonmaskable, highest-priority exceptions
45system reset and machine check.  There are two asynchrononous maskable
46low-priority exceptions external interrupt and decrementer.  Nonmaskable
47execptions are never delayed, therefore if two nonmaskable, asynchronous
48exceptions occur in immediate succession, the state information saved by
49the first exception may be overwritten when the subsequent exception occurs.
50
51The PowerPC arcitecure defines one imprecise exception, the imprecise
52floating point enabled exception.  All other synchronous exceptions are
53precise.  The synchronization occuring during asynchronous precise
54exceptions conforms to the requirements for context synchronization.
55
56@section Vectoring of Interrupt Handler
57
58Upon determining that an exception can be taken the PowerPC automatically
59performs the following actions:
60
61@itemize @bullet
62@item an instruction address is loaded into SRR0
63
64@item bits 33-36 and 42-47 of SRR1 are loaded with information
65specific to the exception.
66
67@item bits 0-32, 37-41, and 48-63 of SRR1 are loaded with corresponding
68bits from the MSR.
69
70@item the MSR is set based upon the exception type.
71
72@item instruction fetch and execution resumes, using the new MSR value, at a location specific to the execption type.
73
74@end itemize
75
76If the interrupt handler was installed as an RTEMS
77interrupt handler, then upon receipt of the interrupt, the
78processor passes control to the RTEMS interrupt handler which
79performs the following actions:
80
81@itemize @bullet
82@item saves the state of the interrupted task on it's stack,
83
84@item saves all registers which are not normally preserved
85by the calling sequence so the user's interrupt service
86routine can be written in a high-level language.
87
88@item if this is the outermost (i.e. non-nested) interrupt,
89then the RTEMS interrupt handler switches from the current stack
90to the interrupt stack,
91
92@item enables exceptions,
93
94@item invokes the vectors to a user interrupt service routine (ISR).
95@end itemize
96
97Asynchronous interrupts are ignored while exceptions are
98disabled.  Synchronous interrupts which occur while are
99disabled result in the CPU being forced into an error mode.
100
101A nested interrupt is processed similarly with the
102exception that the current stack need not be switched to the
103interrupt stack.
104
105@section Interrupt Levels
106
107The PowerPC architecture supports only a single external
108asynchronous interrupt source.  This interrupt source
109may be enabled and disabled via the External Interrupt Enable (EE)
110bit in the Machine State Register (MSR).  Thus only two level (enabled
111and disabled) of external device interrupt priorities are
112directly supported by the PowerPC architecture. 
113
114Some PowerPC implementations include a Critical Interrupt capability
115which is often used to receive interrupts from high priority external
116devices.
117
118The RTEMS interrupt level mapping scheme for the PowerPC is not
119a numeric level as on most RTEMS ports.  It is a bit mapping in
120which the least three significiant bits of the interrupt level
121are mapped directly to the enabling of specific interrupt
122sources as follows:
123
124@table @b
125
126@item Critical Interrupt
127Setting bit 0 (the least significant bit) of the interrupt level
128enables the Critical Interrupt source, if it is available on this
129CPU model.
130
131@item Machine Check
132Setting bit 1 of the interrupt level enables Machine Check execptions.
133
134@item External Interrupt
135Setting bit 2 of the interrupt level enables External Interrupt execptions.
136
137@end table
138
139All other bits in the RTEMS task interrupt level are ignored.
140
141@section Disabling of Interrupts by RTEMS
142
143During the execution of directive calls, critical
144sections of code may be executed.  When these sections are
145encountered, RTEMS disables Critical Interrupts, External Interrupts
146and Machine Checks before the execution of this section and restores
147them to the previous level upon completion of the section.  RTEMS has been
148optimized to insure that interrupts are disabled for less than
149RTEMS_MAXIMUM_DISABLE_PERIOD microseconds on a
150RTEMS_MAXIMUM_DISABLE_PERIOD_MHZ Mhz PowerPC 603e with zero
151wait states.  These numbers will vary based the number of wait
152states and processor speed present on the target board.
153[NOTE:  The maximum period with interrupts disabled is hand calculated.  This
154calculation was last performed for Release
155RTEMS_RELEASE_FOR_MAXIMUM_DISABLE_PERIOD.]
156
157If a PowerPC implementation provides non-maskable interrupts (NMI)
158which cannot be disabled, ISRs which process these interrupts
159MUST NEVER issue RTEMS system calls.  If a directive is invoked,
160unpredictable results may occur due to the inability of RTEMS
161to protect its critical sections.  However, ISRs that make no
162system calls may safely execute as non-maskable interrupts.
163
164@section Interrupt Stack
165
166The PowerPC architecture does not provide for a
167dedicated interrupt stack.  Thus by default, exception handlers would
168execute on the stack of the RTEMS task which they interrupted.
169This artificially inflates the stack requirements for each task
170since EVERY task stack would have to include enough space to
171account for the worst case interrupt stack requirements in
172addition to it's own worst case usage.  RTEMS addresses this
173problem on the PowerPC by providing a dedicated interrupt stack
174managed by software.
175
176During system initialization, RTEMS allocates the
177interrupt stack from the Workspace Area.  The amount of memory
178allocated for the interrupt stack is determined by the
179interrupt_stack_size field in the CPU Configuration Table.  As
180part of processing a non-nested interrupt, RTEMS will switch to
181the interrupt stack before invoking the installed handler.
182
183
184
Note: See TracBrowser for help on using the repository browser.