如何理解ARM异常、中断和向量表

出处:维库电子市场网 发布于:2023-06-20 16:56:33

以前,我一直很疑惑这个“ARM异常、中断以及他们的向量表”是怎么回事,他们到底是怎么实现的,没有想到今天偶然看到(ARM System Developer's Guide: Designing and OpTImizing System Software的ARM异常、中断以及他们的向量表的章节,豁然开朗。——ARM嵌入式系统开发:软件设计与优化的英文原版——我个人感觉这是国内翻译ARM书籍的一本之一,比杜XX的ARM体系结构与编程好千倍。 本书虽然说软件设计与优化,但是讲的硬件也很多,比如MMU和cache等,讲的精彩纷呈:我刚才想写关于MMU和cache的博客,发现太庞大,看来这段时间要重新看看这本书才能写。 
地址: 

————————下面来看看

2.4 ExcepTIons, Interrupts, and the Vector Table

When an excepTIon or interrupt occurs, the processor sets the pc to a speci?c memory
address. The address is within a special address range called the vector table. The entries
in the vector table are instrucTIons that branch to speci?c routines designed to handle a
particular exception or interrupt.

——当异常或者中断发生的时候,处理器设置PC为一个特殊的内存地址。这个地址叫做中断向量表。中断向量表入口是中断、异常的分支入口((*^__^*) 嘻嘻……,这个翻译的好烂,不过大家知道就可以了)。

The memory map address 0x00000000 is reserved for the vector table, a set of 32-bit
words. On some processors the vector table can be optionally located at a higher address
in memory (starting at the offset 0xffff0000). Operating systems such as Linux and
Microsoft’s embedded products can take advantage of this feature.

——内存映射地址0x00000000 是为中断向量表保留的。在某些处理器中断向量表地址为0xffff0000。某些操作系统如linux可以利用这个特征(其实wince就是采用0xffff0000作为中断向量表的地址,但是令人奇怪的是优龙的ADS bootloader的中断向量表地址是0x00000000 ,估计这是编译器决定了)。

When an exception or interrupt occurs, the processor suspends normal execution and
starts loading instructions fromthe exception vector table (see Table 2.6). Each vector table
entry contains a form of branch instruction pointing to the start of a speci?c routine:

——当异常或者中断发生的时候,处理器挂起正常执行的程序并开始加载中断向量表,每个中断入口包含一个指向 speci?c routine(这个不知道怎么翻译)的分支指令。

■ Reset vector is the location of the ?rst instruction executed by the processor when power
is applied. This instruction branches to the initialization code.

——复位向量是打开电源被处理器执行的条指令,这条指令branches to初始化代码
■ Unde?ned instruction vector is used when the processor cannot decode an instruction.

——未定义指令向量,被用在处理器无法解码指令的时候
■ Software interrupt vector is called when you execute a SWI instruction. The SWI
instruction is frequently used as themechanismto invoke an operating systemroutine.

——软件中断向量........软件中断指令常用在操作系统条用。
■ Prefetch abort vector occurs when the processor attempts to fetch an instruction froman
address without the correct access permissions. The actual abort occurs in the decode
stage.

——预取终止向量发生处理器试图取一个指令地址,且没有正确访问许可的时候,实际终止发生在解码阶段
■ Data abort vector is similar to a prefetch abort but is raised when an instruction attempts
to access data memory without the correct access permissions.

——数据终止向量类似预取终止,但是他发生在指令试图访问数据,且内存没有正确访问许可。
■ Interrupt request vector is used by external hardware to interrupt the normal execution
?ow of the processor. It can only be raised if IRQs are not masked in the cpsr.

——中断申请向量被用在外部硬件中断正常执行的程序,它只能在IRQs 没有被cpsr屏蔽的情况下。

====================================================================================


版权与免责声明

凡本网注明“出处:维库电子市场网”的所有作品,版权均属于维库电子市场网,转载请必须注明维库电子市场网,https://www.dzsc.com,违反者本网将追究相关法律责任。

本网转载并注明自其它出处的作品,目的在于传递更多信息,并不代表本网赞同其观点或证实其内容的真实性,不承担此类作品侵权行为的直接责任及连带责任。其他媒体、网站或个人从本网转载时,必须保留本网注明的作品出处,并自负版权等法律责任。

如涉及作品内容、版权等问题,请在作品发表之日起一周内与本网联系,否则视为放弃相关权利。

上传BOM文件: BOM文件
*公司名:
*联系人:
*手机号码:
QQ:
应用领域:

有效期:
OEM清单文件: OEM清单文件
*公司名:
*联系人:
*手机号码:
QQ:
有效期:

扫码下载APP,
一键连接广大的电子世界。

在线人工客服

买家服务:
卖家服务:

0571-85317607

客服在线时间周一至周五
9:00-17:30

关注官方微信号,
第一时间获取资讯。

建议反馈

联系人:

联系方式:

按住滑块,拖拽到最右边
>>
感谢您向阿库提出的宝贵意见,您的参与是维库提升服务的动力!意见一经采纳,将有感恩红包奉上哦!