<!-- /* Font Definitions */ @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"/@宋体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; mso-pagination:none; font-size:10.5pt; mso-bidi-font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:宋体; mso-font-kerning:1.0pt;} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} -->
进入异常
当异常出现时,异常模式分组的 R14 、 SPSR 用于保存状态。
ARM7TDMI (自动)处理异常的步骤:
R14_< exception_mode > = return link ;保护返回地址
SPSR_< exception_mode > = CPSR ;保护状态标志
CPSR[4:0] = exception_mode number ;模式切换
CPSR[5] = 0 ; ARM 状态
If < exception_mode > == Reset or FIQ then
CPSR[6] = 1 ;禁止快中断
/* 否则 CPSR[6] 不变 */
CPSR[7] = 1 ;禁止正常中断
PC = exception vector address ;异常向量地址到 PC
<!-- /* Font Definitions */ @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"/@宋体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; mso-pagination:none; font-size:10.5pt; mso-bidi-font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:宋体; mso-font-kerning:1.0pt;} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} -->
退出异常
R14_< exception_mode > → PC
SPSR_< exception_mode > → CPSR
在恢复 CPSR 时, T 、 F 、 I 自动恢复为异常发生前的值。
例:各种异常返回指令操作:
①、复位:在禁止中断的模式下,从地址 0x00000000/0xffff0000 开始执行程序。
②、数据 中止:SUBS PC ,R14 ,#4
③、 FIQ :SUBS PC ,R14 ,#4
④、 IRQ :SUBS PC ,R14 ,#4
⑤、 预取中止:SUBS PC ,R14 ,#4
⑥、 未定义指令:MOVS PC ,R14
⑦、 SWI :MOVS PC ,R14