
MOTOROLA
Chapter 6. Exceptions
6-17
Part II. PowerPC Microprocessor Module
6.1.5 Recoverability after an Exception
The processor cannot always recover from system reset and machine check interrupts,
either because the conditions that cause the interrupt are catastrophic or because they
caused the save/restore information in SRR0 and SRR1to be overwritten.
All other PowerPC exceptions should be restartable.
Registers such as SRR0 and SRR1
(and for some exceptions the data address register (DAR) and DSI status register (DSISR))
that may be affected by subsequent exceptions should be saved early in the routine to avoid
being overwritten. Likewise, the saved values should be restored to those registers at the
end of the handler routine in such a way that protects them from an exception before the
instruction returns control to the interrupted process. Interrupts should also be masked in
these areas by clearing (disabling) MSR[ME] for system reset and machine check
interrupts
and
MSR[EE]
for
external
implementation-speciTc exceptionsdebug port unmaskable interrupt and breakpoint
interrupt in nonmaskable mode.
interrupt,
decrementer
and
two
The recoverable exception bit (MSR[RI]) is deTned to notify the exception handler code
whether it is in a restartable state. The MSR[RI] shadow bit in SRR1 indicates if the
exception is restartable. This bit does not need to be checked on exception types that are
restartable by convention, except those previously mentioned. When an exception occurs,
MSR[RI] is copied to the equivalent bit in SRR1 and cleared. When an
rT
instruction is
executed, MSR[RI] is copied from SRR1 or software can change the bit by using it the
mtmsr
instruction. The MSR[RI] bit is intended to be set by the exception handler after
saving the machine state, in SRR0 and SRR1 (and DAR and DSISR if needed) and cleared
by the exception handler before retrieving the machine state.
In critical code sections where MSR[EE] is cleared but SRR0 and SRR1 are not busy,
MSR[RI] should remain set. In such cases, if an exception occurs, the process is restartable.
Table 6-18 lists SPRs that facilitate manipulation of MSR[RI] and MSR[EE]. Writing to
these locations performs the speciTed operation. Attempting to read these locations is
treated as an unimplemented instruction and causes a software emulation exception.
Table 6-18. Additional SPRs that Affect MSR Bits
Name
SPR
MSR[EE]
MSR[RI]
Used For
EIE
80
1
1
External interrupt enable:
End of handlers prologue, enable nested external interrupts;
End of critical code segment in which external interrupts were disabled
EID
81
0
1
External interrupt disable, but other exception are recoverable:
End of handlers prologue, keep external nested interrupts disabled;
Start of critical code segment in which external interrupts are disabled
NRI
82
0
0
Nonrecoverable interrupt:
Start of handlers epilogue