6-8
M68000 8-/16-/32-BIT MICROPROCESSORS USER'S MANUAL
MOTOROLA
6.2.3 Multiple Exceptions
These paragraphs describe the processing that occurs when multiple exceptions arise
simultaneously. Exceptions can be grouped by their occurrence and priority. The group 0
exceptions are reset, bus error, and address error. These exceptions cause the instruction
currently being executed to abort and the exception processing to commence within two
clock cycles. The group 1 exceptions are trace and interrupt, privilege violations, and
illegal instructions. Trace and interrupt exceptions allow the current instruction to execute
to completion, but pre-empt the execution of the next instruction by forcing exception
processing to occur. A privilege-violating instruction or an illegal instruction is detected
when it is the next instruction to be executed. The group 2 exceptions occur as part of the
normal processing of instructions. The TRAP, TRAPV, CHK, and zero divide exceptions
are in this group. For these exceptions, the normal execution of an instruction may lead to
exception processing.
Group 0 exceptions have highest priority, whereas group 2 exceptions have lowest
priority. Within group 0, reset has highest priority, followed by address error and then bus
error. Within group 1, trace has priority over external interrupts, which in turn takes priority
over illegal instruction and privilege violation. Since only one instruction can be executed
at a time, no priority relationship applies within group 2.
The priority relationship between two exceptions determines which is taken, or taken first,
if the conditions for both arise simultaneously. Therefore, if a bus error occurs during a
TRAP instruction, the bus error takes precedence, and the TRAP instruction processing is
aborted. In another example, if an interrupt request occurs during the execution of an
instruction while the T bit is asserted, the trace exception has priority and is processed
first. Before instruction execution resumes, however, the interrupt exception is also
processed, and instruction processing finally commences in the interrupt handler routine.
A summary of exception grouping and priority is given in Table 6-3.
As a general rule, the lower the priority of an exception, the sooner the handler routine for
that exception executes. For example, if simultaneous trap, trace, and interrupt exceptions
are pending, the exception processing for the trap occurs first, followed immediately by
exception processing for the trace and then for the interrupt. When the processor resumes
normal instruction execution, it is in the interrupt handler, which returns to the trace
handler, which returns to the trap execution handler. This rule does not apply to the reset
exception; its handler is executed first even though it has the highest priority, because the
reset operation clears all other exceptions.