devicemaps_init()
链接中(约在3.14版本的第1250行)。 /*
* Create a mapping for the machine vectors at the high-vectors
* location (0xffff0000). If we aren't using high-vectors, also
* create a mapping at the low-vectors virtual address.
*/
map.pfn = __phys_to_pfn(virt_to_phys(vectors));
map.virtual = 0xffff0000;
map.length = PAGE_SIZE;
#ifdef CONFIG_KUSER_HELPERS
map.type = MT_HIGH_VECTORS;
#else
map.type = MT_LOW_VECTORS;
#endif
create_mapping(&map);
这里还有其他代码来进行更多的映射。请注意,除了物理向量指令外,还有用于切换模式的代码。这是通过vector_stub
汇编宏完成的。注释中的解释非常好(也可以参见第二个相关链接)。
向量存根。
将此代码复制到0xffff1000,以便我们可以在向量中使用分支而不是ldr。请注意,此代码不得超过页面大小。
公共存根入口宏: 进入IRQ模式,spsr = SVC / USR CPSR,lr = SVC / USR PC
SP指向最少量的处理器专用内存,其地址被复制到r0以供特定于模式的异常处理程序使用。
所以我们可以在向量中使用分支意味着向量表中的第一条指令。