MC68030RC33 Instruction Trap Exception - Motorola



Manufacturer Part Number
Exception Processing
8.1.4 Instruction Trap Exception
Certain instructions are used to explicitly cause trap exceptions. The TRAP #n instruction
always forces an exception and is useful for implementing system calls in user programs.
The TRAPcc, TRAPV, cpTRAPcc, CHK, and CHK2 instructions force exceptions if the user
program detects an error, which may be an arithmetic overflow or a subscript value that is
out of bounds.
The DIVS and DIVU instructions force exceptions if a division operation is attempted with a
divisor of zero.
When a trap exception occurs, the processor copies the status register internally, enters the
supervisor privilege level, and clears the trace bits. If tracing is enabled for the instruction
that caused the trap, a trace exception is taken after the RTE instruction from the trap
handler is executed, and the trace corresponds to the trap instruction; the trap handler
routine is not traced. The processor generates a vector number according to the instruction
being executed; for the TRAP #n instruction, the vector number is 32 plus n. The stack frame
saves the trap vector offset, the program counter, and the internal copy of the status register
on the supervisor stack. The saved value of the program counter is the logical address of
the instruction following the instruction that caused the trap. For all instruction traps other
than TRAP #n, a pointer to the instruction that caused the trap is also saved. Instruction
execution resumes at the address in the exception vector after the required instruction
8.1.5 Illegal Instruction and Unimplemented Instruction Exceptions
An illegal instruction is an instruction that contains any bit pattern in its first word that does
not correspond to the bit pattern of the first word of a valid MC68030 instruction or is a
MOVEC instruction with an undefined register specification field in the first extension word.
An illegal instruction exception corresponds to vector number 4 and occurs when the
processor attempts to execute an illegal instruction.

Related parts for MC68030RC33