Rev. 2.00, 09/03, page 113 of 690
5.2
Exception Handling Function
5.2.1
Exception Handling Flow
In exception handling, the contents of the program counter (PC) and status register (SR) are saved
in the saved program counter (SPC) and saved status register (SSR), respectively, and execution of
the exception handler is invoked from a vector address. The return from exception handler (RTE)
instruction is issued by the exception handler routine on completion of the routine, restoring the
contents of PC and SR to return to the processor state at the point of interruption and the address
where the exception occurred.
A basic exception handling sequence consists of the following operations. If an exception occurs
and the CPU accepts it, operations 1 to 8 are executed.
1.
The address of the instruction to be returned to after exception handling is saved to SPC.
2.
The contents of SR is saved in SSR.
3.
The block (BL) bit in SR is set to 1, masking any subsequent exceptions.
4.
The mode (MD) bit in SR is set to 1 to place the privileged mode.
5.
The register bank (RB) bit in SR is set to 1.
6.
An exception code identifying the exception event is written to bits 11 to 0 of the exception
event (EXPEVT) or interrupt event (INTEVT or INTEVT2) register.
7.
If a TRAPA instruction is executed, an 8-bit immediate data specified by the TRAPA
instruction is set to TRA. For an exception related to memory accesses, the logic address
where the exception occurred is written to TEA.*
1
8.
Instruction execution jumps to the designated exception vector address to invoke the handler
routine.
The above operations from 1 to 8 are executed in sequence. During these operations, no other
exceptions may be accepted unless multiple exception acceptance is enabled.
In an exception handling routine for a general exception, the appropriate exception handling must
be executed based on an exception source determined by the EXPEVP. In an interrupt exception
handling routine, the appropriate exception handling must be executed based on an exception
source determined by the INTEVT or INTEVT2. After the exception handling routine has been
completed, program execution can be resumed by executing an RTE instruction. The RTE
instruction causes the following operations to be executed.
1.
The contents of the SSR are restored into the SR to return to the processing state in effect
before the exception handling took place.
2.
A delay slot instruction of the RTE instruction is executed.*
2
3.
Control is passed to the address stored in the SPC.
Содержание SH7705
Страница 2: ......
Страница 46: ...Rev 2 00 09 03 page xlvi of xlvi Appendix Table A 1 I O Port States in Each Processing State 679 ...
Страница 70: ...Rev 2 00 09 03 page 24 of 690 ...
Страница 194: ...Rev 2 00 09 03 page 148 of 690 ...
Страница 284: ...Rev 2 00 09 03 page 238 of 690 ...
Страница 338: ...Rev 2 00 09 03 page 292 of 690 ...
Страница 354: ...Rev 2 00 09 03 page 308 of 690 ...
Страница 374: ...Rev 2 00 09 03 page 328 of 690 ...
Страница 420: ...Rev 2 00 09 03 page 374 of 690 ...
Страница 476: ...Rev 2 00 09 03 page 430 of 690 ...
Страница 482: ...Rev 2 00 09 03 page 436 of 690 ...
Страница 552: ...Rev 2 00 09 03 page 506 of 690 ...
Страница 630: ...Rev 2 00 09 03 page 584 of 690 ...
Страница 739: ...SH7705 Group Hardware Manual REJ09B0082 0200O ...