4-2
MPC7400 RISC Microprocessor Users Manual
The PowerPC architecture requires that exceptions be taken in program order; therefore,
although a particular implementation may recognize exception conditions out of order, they
are handled strictly in order with respect to the instruction stream. When an
instruction-caused exception is recognized, any unexecuted instructions that appear earlier
in the instruction stream, including any that have not yet entered the execute state, are
required to complete before the exception is taken. In addition, if a single instruction
encounters multiple exception conditions, those exceptions are taken and handled
sequentially. Likewise, exceptions that are asynchronous and precise are recognized when
they occur, but are not handled until all instructions currently in the execute stage
successfully complete execution and report their results.
To prevent loss of state information, exception handlers must save the information stored
in the machine status save/restore registers, SRR0 and SRR1, soon after the exception is
taken to prevent this information from being lost due to another exception being taken.
Because exceptions can occur while an exception handler routine is executing, multiple
exceptions can become nested. It is up to the exception handler to save the necessary state
information if control is to return to the excepting program.
In many cases, after the exception handler handles an exception, there is an attempt to
execute the instruction that caused the exception. Instruction execution continues until the
next exception condition is encountered. Recognizing and handling exception conditions
sequentially guarantees that the machine state is recoverable and processing can resume
without losing instruction results.
In this book, the following terms are used to describe the stages of exception processing:
Recognition
Exception recognition occurs when the condition that can cause an
exception is identiTed by the processor.
Taken
An exception is said to be taken when control of instruction
execution is passed to the exception handler; that is, the context is
saved and the instruction at the appropriate vector offset is fetched
and the exception handler routine is begun in supervisor mode.
Handling
Exception handling is performed by the software linked to the
appropriate vector offset. Exception handling is begun in supervisor
mode (referred to as privileged state in the architecture
speciTcation).
Note that the PowerPC architecture documentation refers to exceptions as interrupts. In this
book, the term interrupt is reserved to refer to asynchronous exceptions and sometimes to
the event that causes the exception. Also, the PowerPC architecture uses the word
exception to refer to IEEE-deTned oating-point exception conditions that may cause a
program exception to be taken; see Section 4.6.7, òProgram Exception (0x00700).ó The
occurrence of these IEEE exceptions may not cause an exception to be taken. IEEE-deTned
exceptions are referred to as IEEE oating-point exceptions or oating-point exceptions.