Interrupt and Exception Handling
MOTOROLA
MC68322 USER’S MANUAL
5-13
As an extreme illustration of these rules, consider the arrival of an interrupt during the
execution of a trap instruction while tracing is enabled. First, the trap exception is
processed, then the trace exception, and finally the interrupt exception. After the execution
of the instruction is complete and before the start of the next instruction, exception
processing for a trace begins and a copy of the internal status register is made. The
transition to supervisor mode is made and the T bit of the internal status register is turned
off, thus disabling further tracing. The vector number is generated to reference the trace
exception vector and the current internal program counter and the copy of the internal status
register are saved on the supervisor stack. The saved value of the internal program counter
is the address of the next instruction. Instruction execution commences at the address
contained in the trace exception vector.
5.4.2.7 ADDRESS ERROR. An address error exception occurs when the core attempts to
access a word or long-word operand or an instruction at an odd address. The bus cycle is
aborted and the core ceases current processing and begins exception processing. Likewise,
if an address error occurs during the exception processing for an address error (or reset) the
core is halted. A common example of address error generation is when the stack pointer is
pointing at an odd address.
5.4.2 Multiple Exceptions
When multiple exceptions occur simultaneously, they are processed according to a fixed
priority. Table 5-4 lists the exceptions, grouped by characteristics, with group 0 having the
highest priority. Within group 0, reset has the highest priority, followed by an address error.
Within group 1, trace has priority over external interrupts, which 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 one is taken (or taken
first) if the conditions for both arise simultaneously. In another example, if an interrupt event
occurs during the execution of an instruction while the T bit in the internal status register is
asserted, the trace exception has priority and is processed first. However, before instruction
execution resumes, the interrupt exception is processed. As a general rule, the lower the
priority of an exception, the sooner the handler routine for that exception executes. 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.
Table 5-4. Exception Grouping and Priority
GROUP
EXCEPTION
PROCESSING
0
Reset and Address Error
Exception Processing Begins Within Two Clock Cycles.
1
Trace, Interrupt, Illegal, and Privilege
Exception Processing Begins Before The Next Instruction.
2
trap, trapv, chk, and div
Exception Processing Is Started By Normal Instruction Execution.
F
re
e
sc
a
le
S
e
m
ic
o
n
d
u
c
to
r,
I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
c
..
.