2

How would I relocate the ARM exception vectors?

Basically, I need to be able to remap them in a way, so when the ARM core tries to execute the vector, it should execute the custom exception vector that is stored in kernel's RAM bit and not in the ROM that is at 0x0. Is that possible? Or am I meant to route the interrupts to the kernel from the ROM?

So essentially, is there a way of telling the ARM core, "here is the new address for your vector table"? I know that you can start the CPU in the high vector mode, but that's not what I'm looking for. I need to be able to set the vector base to a custom address dynamically.

4

4 回答 4

6

这高度依赖于您正在使用的核心。

Cortex-M3 芯片可以使用系统控制块中的向量表偏移寄存器 (VTOR) 更改基地址。一些实现可能会限制可能的地址。

在“传统”芯片(ARM7/9、Cortex-A/R)中,我认为没有一个允许您指定任意基数,尽管它们中的大多数可以在 00000000 和 FFFF0000 之间切换,少数允许使用“start of RAM”地址。

但是,如果芯片有 MMU,您通常可以在 FFFF0000 映射一个 RAM 页面并将您的处理程序复制到那里。我相信这就是 Linux 所做的。

于 2012-01-23T11:54:31.897 回答
1

此外,如果您的处理器具有安全扩展,您可以使用 VBAR(向量基地址寄存器)

MCR p15, 0, <Rt>, c12, c0, 0

请参阅 ARM 体系结构参考手册中的 B4.1.156。

于 2014-03-26T03:19:33.890 回答
1

对于 cortex-A9 处理器,这可以通过使用 Cp15 协处理器寄存器中的 VBAR 寄存器来完成。向量基地址寄存器的目的是保存监视器异常向量的基地址。

 MRC p15, 0, <Rd>, c12, c0, 0    ; Read Secure or Non-secure Vector Base Address Register
 MCR p15, 0, <Rd>, c12, c0, 0    ; Write Secure or Non-secure Vector Base Address Register
于 2016-10-26T10:34:50.860 回答
0

系统寄存器 VBAR 指定向量表的基地址。VBAR 可以从 PL1 或更高版本更改。与大多数系统寄存器一样,VBAR 在实施安全扩展 (TrustZone) 时也会被存储。

于 2016-01-07T04:41:43.163 回答