6-20
M68000 8-/16-/32-BIT MICROPROCESSORS USER'S MANUAL
MOTOROLA
6.4 RETURN FROM EXCEPTION (MC68010)
In addition to returning from any exception handler routine on the MC68010, the RTE
instruction resumes the execution of a suspended instruction by returning to the normal
processing state after restoring all of the temporary register and control information stored
during a bus error. For the RTE instruction to execute properly, the stack must contain
valid and accessible data. The RTE instruction checks for data validity in two ways. First,
the format/offset word is checked for a valid stack format code. Second, if the format code
indicates the long stack format, the validity of the long stack data is checked as it is loaded
into the processor. In addition, the data is checked for accessibility when the processor
starts reading the long data. Because of these checks, the RTE instruction executes as
follows:
1. Determine the stack format. This step is the same for any stack format and consists
of reading the status register, program counter, and format/offset word. If the format
code indicates a short stack format, execution continues at the new program counter
address. If the format code is not an MC68010-defined stack format code, exception
processing starts for a format error.
2. Determine data validity. For a long-stack format, the MC68010 begins to read the
remaining stack data, checking for validity of the data. The only word checked for
validity is the first of the 16 internal information words (SP + 26) shown in Figure 5-8.
This word contains a processor version number (in bits 10–13) and proprietary
internal information that must match the version number of the MC68010 attempting
to read the data. This validity check is used to ensure that the data is properly
interpreted by the RTE instruction. If the version number is incorrect for this
processor, the RTE instruction is aborted and exception processing begins for a
format error exception. Since the stack pointer is not updated until the RTE
instruction has successfully read all the stack data, a format error occurring at this
point does not stack new data over the previous bus error stack information.
3. Determine data accessibility. If the long-stack data is valid, the MC68010 performs a
read from the last word (SP + 56) of the long stack to determine data accessibility. If
this read is terminated normally, the processor assumes that the remaining words on
the stack frame are also accessible. If a bus error is signaled before or during this
read, a bus error exception is taken. After this read, the processor must be able to
load the remaining data without receiving a bus error; therefore, if a bus error occurs
on any of the remaining stack reads, the error becomes a double bus fault, and the
MC68010 enters the halted state.