我在学习中断的时候,遇到问题:
AM335X_Software
static void CopyVectorTable(void)
{
unsigned int *dest = (unsigned int *)AM335X_VECTOR_BASE;
unsigned int *src = (unsigned int *)vecTbl;
unsigned int count;
CP15VectorBaseAddrSet(AM335X_VECTOR_BASE);
for(count = 0; count < sizeof(vecTbl)/sizeof(vecTbl[0]); count++)
{
dest[count] = src[count];
}
}
const unsigned int AM335X_VECTOR_BASE = 0x4030FC00;
static unsigned int const vecTbl[14]=
{
0xE59FF018, /* Opcode for loading PC with the contents of [PC + 0x18] */
0xE59FF018, /* Opcode for loading PC with the contents of [PC + 0x18] */
0xE59FF018, /* Opcode for loading PC with the contents of [PC + 0x18] */
0xE59FF018, /* Opcode for loading PC with the contents of [PC + 0x18] */
0xE59FF014, /* Opcode for loading PC with the contents of [PC + 0x14] */
0xE24FF008, /* Opcode for loading PC with (PC – 8) (eq. to while(1)) */
0xE59FF010, /* Opcode for loading PC with the contents of [PC + 0x10] */
0xE59FF010, /* Opcode for loading PC with the contents of [PC + 0x10] */
(unsigned int)Entry,
(unsigned int)UndefInstHandler,
(unsigned int)SVCHandler,
(unsigned int)AbortHandler,
(unsigned int)IRQHandler,
(unsigned int)FIQHandler
};
上面的代码是把 vecTbl[14] copy到向量入口地0x4030FC00。
问题 1: 假如发生IRQ中断,PC指针是不是等于:0x4030FC00 + 0x18, 从这里取指令?
如果是,那么这个 0xE24FF008, 是什么意思?
TI的文档或ARM有没有文档说明这个值是什么?
问题2: 从上面的vecTbl表中,我很容易看成,中断来了,PC是从 (unsigned int)IRQHandler取指,然后跑到这个函数上去。但是,TI的 starterWare为什么要加上前面那一堆数字让人难理解呢?
求解释!!!!!!! 或指出在什么地方可以查到资料.
Yaoming Qin:
你看看arm的technical reference manual, CP15里面有寄存配置中断向量的入口地址的
zhihua xie zhihua xie:
回复 Yaoming Qin:
When an exception branches to the Monitor mode, the core branches to address:Monitor_Base_Address + Exception_Vector_Address. 内存地址 指令0x4030FC00: 0xE59FF018,0x4030FC04: 0xE59FF018,0x4030FC08: 0xE59FF018,0x4030FC0c: 0xE59FF018,0x4030FC10: 0xE59FF014,0x4030FC14: 0xE24FF008,0x4030FC18: 0xE59FF010,0x4030FC1c: 0xE59FF010,0x4030FC20: (unsigned int)Entry,0x4030FC24: (unsigned int)UndefInstHandler,0x4030FC28: (unsigned int)SVCHandler,0x4030FC2c: (unsigned int)AbortHandler,0x4030FC30: (unsigned int)IRQHandler,0x4030FC34: (unsigned int)FIQHandler
当IRQ中断来的时候,PC = 0x4030FC18, ARM 取到指令:0xE59FF010 这个值,会去干什么呢(进行什么操作?)
我想问的是: 0xE59FF018 0xE59FF010 0xE24FF008 等,这些值是干什么的,一直搞不明白。。。。。
Yaoming Qin:
回复 zhihua xie zhihua xie:
这些都是机器码,会对应一些指令,也就是对PC load的一些指令,你可以用仿真器跟进去看看,最后回到各种异常模式的处理里面去