
2-34
MCF5407 User’s Manual
Exception Processing Overview
2.8.2 Processor Exceptions
Table 2-22. MCF5407 Exceptions
Exception
Description
Access Error
Access errors are reported only in conjunction with an attempted store to write-protected memory.
Thus, access errors associated with instruction fetch or operand read accesses are not possible.
The Version 4 processor, unlike the Version 2 and 3 processors, updates the condition code register
if a write-protect error occurs during a CLR or MOV3Q operation to memory.
Address
Error
Caused by an attempted execution transferring control to an odd instruction address (that is, if bit 0 of
the target address is set), an attempted use of a word-sized index register (Xi.w) or a scale factor of
8 on an indexed effective addressing mode, or attempted execution of an instruction with a full-format
indexed addressing mode.
If an address error occurs on a JSR instruction, the Version 4 processor rst pushes the return
address onto the stack and then calculates the target address. On Version 2 and 3 processors, these
functions are reversed.
If an address error occurs on an RTS instruction, the Version 4 processor preserves the original
return PC and writes the exception stack frame above this value. On Version 2 and 3 processors, the
faulting return PC is overwritten by the address error stack frame.
Illegal
Instruction
On Version 2 ColdFire implementations, only some illegal opcodes were decoded and generated an
illegal instruction exception. Version 3 and Version 4 processors decode the full 16-bit opcode and
generate this exception if execution of an unsupported instruction is attempted. Additionally,
attempting to execute an illegal line A or line F opcode generates unique exception types: vectors 10
and 11, respectively.
ColdFire processors do not provide illegal instruction detection on extension words of any instruction,
including MOVEC. Attempting to execute an instruction with an illegal extension word causes
undened results.
Divide by
Zero
Attempted division by zero causes an exception (vector 5, offset = 0x014) except when the PC points
to the faulting instruction (DIVU, DIVS, REMU, REMS).
Privilege
Violation
Caused by attempted execution of a supervisor mode instruction while in user mode. The
ColdFire
Programmer’s Reference Manual lists supervisor- and user-mode instructions.
Trace
Exception
ColdFire processors provide instruction-by-instruction tracing. While the processor is in trace mode
(SR[T] = 1), instruction completion signals a trace exception. This allows a debugger to monitor
program execution.
The only exception to this denition is the STOP instruction. If the processor is in trace mode, the
instruction before the STOP executes and then generates a trace exception. In the exception stack
frame, the PC points to the STOP opcode. When the trace handler is exited, the STOP instruction is
executed, loading the SR with the immediate operand from the instruction. The processor then
generates a trace exception. The PC in the exception stack frame points to the instruction after
STOP, and the SR reects the just-loaded value.
If the processor is not in trace mode and executes a STOP instruction where the immediate operand
sets the trace bit in the SR, hardware loads the SR and generates a trace exception. The PC in the
exception stack frame points to the instruction after STOP, and the SR reects the just-loaded value.
Because ColdFire processors do not support hardware stacking of multiple exceptions, it is the
responsibility of the operating system to check for trace mode after processing other exception types.
As an example, consider a TRAP instruction executing in trace mode. The processor initiates the
TRAP exception and passes control to the corresponding handler. If the system requires that a trace
exception be processed, the TRAP exception handler must check for this condition (SR[15] in the
exception stack frame asserted) and pass control to the trace handler before returning from the
original exception.