如何理解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.
——当异常或者中断发生的时候,处理器设置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(具体看编译器),以前我总是从软件角度去学习,大错特错。

最新vivo TWS 2真无线降噪耳机体验如何?
风力发电广播对讲解决方案
RF24-70mm F2.8 L IS USM 体验 表现可以说是相当的惊艳
欧菲光拟以 1.04 亿元出售与非美国大客户触控显示业务相关无形资产
除静电离子风嘴的工业优势
如何理解ARM异常、中断和向量表
降噪耳机哪款好_降噪无线蓝牙耳机推荐
5G商用正式开启,苹果落后已成必然!
618预售五大爆款蓝牙耳机推荐
无人机飞行控制器系统解决方案大汇总
多孔碳负载钴基催化剂的设计助力高性能柔性锌-空气电池
音响中分频器和功放的连接方式
苹果M1处理器安兔兔跑分成绩曝光,已打破历史记录
PT2035蓝牙耳机专用触摸芯片概述、特性及应用电路
云智能WIFI门锁开关控制器的特点
ZYNQ 7系列FSBL的启动过程与配置方法
AC-DC交流电源在测试条件下的应用
音响的名词解释
苹果为什么会考虑牵手现代一起造车?
Bourns 推出全新高压二电极气体放电管 (GDT) 系列 专为符合 IEC 62368-1 的设备和电力线保护而设计