主题 : 使用supervivi加载的程序如何处理中断向量 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 924
精华: 0
发帖: 5
金钱: 35 两
威望: 5 点
综合积分: 10 分
注册时间: 2008-06-22
最后登录: 2016-02-20
楼主  发表于: 2008-07-05 16:26

 使用supervivi加载的程序如何处理中断向量

使用vivi加载的程序如何处理中断向量
程序使用了supervivi作为引导程序,把镜像通过usb复制到了SDRAM里执行,但是如何处理中断向量(IRQ)?现在只能运行没有中断的程序?
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2008-07-05 19:11
Linux 内核也是用supervivi加载的程序,不是可以处理中断?
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 924
精华: 0
发帖: 5
金钱: 35 两
威望: 5 点
综合积分: 10 分
注册时间: 2008-06-22
最后登录: 2016-02-20
2楼  发表于: 2008-07-05 21:05
对啊,具体怎么实现呢?
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
3楼  发表于: 2008-07-06 08:32
首先澄清一点,通过程序是否能处理中断向量和它们是不是被supervivi加载没有关系。Linux内核运行起来以后就和supervivi没有关系了。内核之所以可以处理中断,简单的说,是因为它打开了ARM核的IRQ模式,并且把一个中断向量表放到了合适的地方。
事实上,supervivi本身通过上面的步骤也可以处理中断。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 侠客
UID: 4843
精华: 0
发帖: 102
金钱: 810 两
威望: 554 点
综合积分: 204 分
注册时间: 2009-03-31
最后登录: 2012-11-14
4楼  发表于: 2009-05-25 00:28
问题是vivi加载的程序的运行地址是在SDRAM中,所以其中断向量应该是设置在0x30000000处。而ARM9的默认中断向量是在0x00处开始的。

是不是vivi把程序加载后,在跳转到0x30000000之前,把中断向量重新映射到了0x30000000处呢?或者的vivi根本没有重新映射向量表,只是因为建立在SDRAM中的次向量表(伪向量表) _ISR_STARTADDRESS 相同,故程序能够正确运行。

或者我的理解有什么错误的地方?
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
5楼  发表于: 2009-05-25 10:30
任何需要设定中断向量表的程序都会通过下面两种或方式设定ARM的中断向量表
1. MMU关闭情况下,将各种exception模式的入口跳转表, 即中断向量表写到CPU内建的向量表入口地址,比如0x0(物理地址)
2. MMU开启情况下,将ARM中断向量表地址(虚拟地址)映射到程序设定的入口地址(虚拟地址)上,比如(0x0 -> 0xE0000000),然后在该地址上写入向量表的入口地址

这里要注意的是,ARM的中断向量表地址有两个(0x0和0xffff0000), 由CP15的c1 Control Register V bit 控制
参考http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0211h/Babfeega.html
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
6楼  发表于: 2009-05-25 10:34
关于ARM9,ARM公司的ARMv5 Archtecture Reference Manual是最好最权威的手册:
http://infocenter.arm.com/help/topic/com.arm.doc.ddi0100i/index.html
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."