您的位置 首页 嵌入式

怎么了解ARM反常、中止和向量表

如何理解ARM异常、中断和向量表-以前,我一直很疑惑这个“ ARM异常 、 中断以 及他们的 向量表 ”是怎么回事,他们到底是怎么实现的,没有想到今天偶然看到(ARM System Developers Guide: Designing and Optimizing System Software的ARM异常、中断以及他们的向量表的章节,豁然开朗。

曾经,我一向很疑问这个“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 specific 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 specific routines designed to handle a
particular exception or interrupt.

怎样了解ARM反常、中止和向量表

——当反常或许中止产生的时分,处理器设置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 specific routine:

——当反常或许中止产生的时分,处理器挂起正常履行的程序并开端加载中止向量表,每个中止进口包括一个指向 specific routine(这个不知道怎样翻译)的分支指令。

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

——复位向量是翻开电源被处理器履行的第一条指令,这条指令branches to初始化代码
■ Undefined 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
flow of the processor. It can only be raised if IRQs are not masked in the cpsr.

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

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

总结:这个中止向量的查找是由硬件完成的,硬件指定PC跳到0xffff0000/0x00000000(详细看编译器),曾经我总是从软件视点去学习,大错特错。

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/qianrushi/347526.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部