Rev. 1.50, 10/04, page 302 of 448
10.1.57 RTE (Return from Exception): System Control Instruction
Format
Operation
Instruction Code
Cycle
T Bit
RTE
SSR
→
SR, SPC
→
PC
0000000000101011
4 —
Description:
This instruction returns from an exception or interrupt handling routine by restoring
the PC and SR values from SPC and SSR. Program execution continues from the address specified
by the restored PC value.
RTE is a privileged instruction, and can only be used in privileged mode. Use of this instruction in
user mode will cause an illegal instruction exception.
Notes:
As this is a delayed branch instruction, the instruction following the RTE instruction is
executed before the branch destination instruction.
Interrupts are not accepted between this instruction and the following instruction. An exception
must not be generated by the instruction in this instruction's delay slot. If the following instruction
is a branch instruction, it is identified as a slot illegal instruction.
If this instruction is located in the delay slot immediately following a delayed branch instruction, it
is identified as a slot illegal instruction.
The SR value accessed by the instruction in the RTE delay slot is the value restored from SSR by
the RTE instruction. The SR and MD values defined prior to RTE execution are used to fetch the
instruction in the RTE delay slot.
Operation:
RTE( ) /* RTE */
{
unsigned int temp;
temp = PC;
SR = SSR;
PC = SPC;
Delay_Slot(temp+2);
}
Example:
RTE
;
Return to original routine.
ADD
#8,R14
;
Executed before branch.
Summary of Contents for SuperH SH-4A
Page 2: ...Rev 1 50 10 04 page ii of xx ...
Page 8: ...Rev 1 50 10 04 page viii of xx ...
Page 116: ...Rev 1 50 10 04 page 96 of 448 ...
Page 178: ...Rev 1 50 10 04 page 158 of 448 ...
Page 206: ...Rev 1 50 10 04 page 186 of 448 ...
Page 231: ...Rev 1 50 10 04 page 211 of 448 Possible Exceptions Slot illegal instruction exception ...
Page 235: ...Rev 1 50 10 04 page 215 of 448 Possible Exceptions Slot illegal instruction exception ...
Page 238: ...Rev 1 50 10 04 page 218 of 448 Possible Exceptions Slot illegal instruction exception ...
Page 408: ...Rev 1 50 10 04 page 388 of 448 Possible Exceptions Inexact Not generated when FPSCR PR 1 ...
Page 446: ...Rev 1 50 10 04 page 426 of 448 ...
Page 468: ...Rev 1 50 10 04 page 448 of 448 ...
Page 471: ......
Page 472: ...SH 4A Software Manual ...