好,
是的,PC指向未处理的异常处理程序。
据我所知,我需要在指令处设置一个断点,该地址就在LR中包含的地址之前,对吧?
好。我不认为我不会在那里找到任何有用的东西。只有少数指令使用局部变量(也没有指针,也没有其他'危险'的东西)
通过文档,我找到了这个(第415页,参考手册RM0032):
'每个中断都有一个相关的中断向量地址,通过将IVPR [32-47]与相关IVOR中的地址索引连接得到(即IVPR [32-47] || IVORn [48-59] || 0b0)。结果地址是发生中断时要执行的指令的地址。 IVPR和IVOR值在复位时不确定,必须由系统软件使用mtspr初始化。 “
所以我去查看启动代码,我在'boot.s'文件中找到了这个:
*异常向量初始化。
* /
.align 2
_ivinit:
/ * MSR初始化。* /
e_lis%r3,HI(MSR_DEFAULT)
e_or2i%r3,LO(MSR_DEFAULT)
mtMSR%r3
/ * IVPR初始化。* /
e_lis%r3,HI(__ ivpr_base__)
e_or2i%r3,LO(__ ivpr_base__)
mtIVPR%r3
/ * IVOR初始化。* /
e_lis%r3,HI(_unhandled_exception)
e_or2i%r3,LO(_unhandled_exception)
mtspr 400,%r3 / * IVOR0-15 * /
mtspr 401,%r3
mtspr 402,%r3
mtspr 403,%r3
mtspr 404,%r3
mtspr 405,%r3
mtspr 406,%r3
mtspr 407,%r3
mtspr 408,%r3
mtspr 409,%r3
mtspr 410,%r3
mtspr 411,%r3
mtspr 412,%r3
mtspr 413,%r3
mtspr 414,%r3
mtspr 415,%r3
mtspr 528,%r3 / * IVOR32-34 * /
mtspr 529,%r3
mtspr 530,%r3
se_blr
.section .handlers,'axv'
/ *
*未处理的异常处理程序。
* /
.weak _unhandled_exception
.type _unhandled_exception,@ function
_未处理的异常:
e_b _unhandled_exception
♯endif/ *!defined(__ DOXYGEN__)* /看起来像处理程序地址包含在IVOR 0-15和IVOR 32-34中的所有中断事件都链接到预定义的未处理异常处理程序。
这是否意味着如果其中任何一个源会引发其中断标志,该事件将触发未处理的异常处理程序?我猜是这样..
所以我需要检查谁正在发出一个中断标志(不应该这样做),对吧?
查看未处理的异常处理程序的汇编代码我认为我的应用程序被卡住的原因是因为处理程序只是一个无限循环..
如果更改了未处理的异常以便它只是从中断返回怎么办?这会让应用程序继续进行吗?
谢谢。
问候
亚历山德罗
以上来自于谷歌翻译
以下为原文
OK,
yes, the PC points to the unhandled exception handler.
As far as I understand I need to put a breakpoint at the instruction which address is just before the one contained in LR, right?
Good. I dont think I'm not goingo to find anything useful there. Just few instructions working with local variables (nor pointers, neither other 'dangerous' stuff)
Going through the documentation, I found this (page 415, reference manual RM0032):
'Each interrupt has an associated interrupt vector address, obtained by concatenating IVPR[32–47] with the address index in the associated IVOR (that is, IVPR[32– 47] || IVORn[48–59] || 0b0). The resulting address is that of the instruction to be executed when that interrupt occurs. IVPR and IVOR values are indeterminate on reset and must be initialized by the system software using mtspr. '
So I went to look at the startup code, and I found this, in the 'boot.s' file:
* Exception vectors initialization.
*/
.align 2
_ivinit:
/* MSR initialization.*/
e_lis %r3, HI(MSR_DEFAULT)
e_or2i %r3, LO(MSR_DEFAULT)
mtMSR %r3
/* IVPR initialization.*/
e_lis %r3, HI(__ivpr_base__)
e_or2i %r3, LO(__ivpr_base__)
mtIVPR %r3
/* IVORs initialization.*/
e_lis %r3, HI(_unhandled_exception)
e_or2i %r3, LO(_unhandled_exception)
mtspr 400, %r3 /* IVOR0-15 */
mtspr 401, %r3
mtspr 402, %r3
mtspr 403, %r3
mtspr 404, %r3
mtspr 405, %r3
mtspr 406, %r3
mtspr 407, %r3
mtspr 408, %r3
mtspr 409, %r3
mtspr 410, %r3
mtspr 411, %r3
mtspr 412, %r3
mtspr 413, %r3
mtspr 414, %r3
mtspr 415, %r3
mtspr 528, %r3 /* IVOR32-34 */
mtspr 529, %r3
mtspr 530, %r3
se_blr
.section .handlers, 'axv'
/*
* Unhandled exceptions handler.
*/
.weak _unhandled_exception
.type _unhandled_exception, @function
_unhandled_exception:
e_b _unhandled_exception
♯ endif /* !defined(__DOXYGEN__) */Which looks like all interrupt events which handler address is contained in IVOR 0-15 and IVOR 32-34 are linked to the predefined unhandled exception handler.
Does this mean that if any of those sources would raise its interrupt flag, that event will trigger the unhandled exception handler? I guess so..
So I need to check who's rasing an interrupt flag (not being supposed to do so), right?
Looking at the assembly code of the unhandled exception handler I think the reason why my application gets stuck is because the handler is just an endless loop..
And what if changed the unhandled exception so that it just returns from interrupt? Would that allow the application to go ahead?
Thank you.
Regards
Alessandro
好,
是的,PC指向未处理的异常处理程序。
据我所知,我需要在指令处设置一个断点,该地址就在LR中包含的地址之前,对吧?
好。我不认为我不会在那里找到任何有用的东西。只有少数指令使用局部变量(也没有指针,也没有其他'危险'的东西)
通过文档,我找到了这个(第415页,参考手册RM0032):
'每个中断都有一个相关的中断向量地址,通过将IVPR [32-47]与相关IVOR中的地址索引连接得到(即IVPR [32-47] || IVORn [48-59] || 0b0)。结果地址是发生中断时要执行的指令的地址。 IVPR和IVOR值在复位时不确定,必须由系统软件使用mtspr初始化。 “
所以我去查看启动代码,我在'boot.s'文件中找到了这个:
*异常向量初始化。
* /
.align 2
_ivinit:
/ * MSR初始化。* /
e_lis%r3,HI(MSR_DEFAULT)
e_or2i%r3,LO(MSR_DEFAULT)
mtMSR%r3
/ * IVPR初始化。* /
e_lis%r3,HI(__ ivpr_base__)
e_or2i%r3,LO(__ ivpr_base__)
mtIVPR%r3
/ * IVOR初始化。* /
e_lis%r3,HI(_unhandled_exception)
e_or2i%r3,LO(_unhandled_exception)
mtspr 400,%r3 / * IVOR0-15 * /
mtspr 401,%r3
mtspr 402,%r3
mtspr 403,%r3
mtspr 404,%r3
mtspr 405,%r3
mtspr 406,%r3
mtspr 407,%r3
mtspr 408,%r3
mtspr 409,%r3
mtspr 410,%r3
mtspr 411,%r3
mtspr 412,%r3
mtspr 413,%r3
mtspr 414,%r3
mtspr 415,%r3
mtspr 528,%r3 / * IVOR32-34 * /
mtspr 529,%r3
mtspr 530,%r3
se_blr
.section .handlers,'axv'
/ *
*未处理的异常处理程序。
* /
.weak _unhandled_exception
.type _unhandled_exception,@ function
_未处理的异常:
e_b _unhandled_exception
♯endif/ *!defined(__ DOXYGEN__)* /看起来像处理程序地址包含在IVOR 0-15和IVOR 32-34中的所有中断事件都链接到预定义的未处理异常处理程序。
这是否意味着如果其中任何一个源会引发其中断标志,该事件将触发未处理的异常处理程序?我猜是这样..
所以我需要检查谁正在发出一个中断标志(不应该这样做),对吧?
查看未处理的异常处理程序的汇编代码我认为我的应用程序被卡住的原因是因为处理程序只是一个无限循环..
如果更改了未处理的异常以便它只是从中断返回怎么办?这会让应用程序继续进行吗?
谢谢。
问候
亚历山德罗
以上来自于谷歌翻译
以下为原文
OK,
yes, the PC points to the unhandled exception handler.
As far as I understand I need to put a breakpoint at the instruction which address is just before the one contained in LR, right?
Good. I dont think I'm not goingo to find anything useful there. Just few instructions working with local variables (nor pointers, neither other 'dangerous' stuff)
Going through the documentation, I found this (page 415, reference manual RM0032):
'Each interrupt has an associated interrupt vector address, obtained by concatenating IVPR[32–47] with the address index in the associated IVOR (that is, IVPR[32– 47] || IVORn[48–59] || 0b0). The resulting address is that of the instruction to be executed when that interrupt occurs. IVPR and IVOR values are indeterminate on reset and must be initialized by the system software using mtspr. '
So I went to look at the startup code, and I found this, in the 'boot.s' file:
* Exception vectors initialization.
*/
.align 2
_ivinit:
/* MSR initialization.*/
e_lis %r3, HI(MSR_DEFAULT)
e_or2i %r3, LO(MSR_DEFAULT)
mtMSR %r3
/* IVPR initialization.*/
e_lis %r3, HI(__ivpr_base__)
e_or2i %r3, LO(__ivpr_base__)
mtIVPR %r3
/* IVORs initialization.*/
e_lis %r3, HI(_unhandled_exception)
e_or2i %r3, LO(_unhandled_exception)
mtspr 400, %r3 /* IVOR0-15 */
mtspr 401, %r3
mtspr 402, %r3
mtspr 403, %r3
mtspr 404, %r3
mtspr 405, %r3
mtspr 406, %r3
mtspr 407, %r3
mtspr 408, %r3
mtspr 409, %r3
mtspr 410, %r3
mtspr 411, %r3
mtspr 412, %r3
mtspr 413, %r3
mtspr 414, %r3
mtspr 415, %r3
mtspr 528, %r3 /* IVOR32-34 */
mtspr 529, %r3
mtspr 530, %r3
se_blr
.section .handlers, 'axv'
/*
* Unhandled exceptions handler.
*/
.weak _unhandled_exception
.type _unhandled_exception, @function
_unhandled_exception:
e_b _unhandled_exception
♯ endif /* !defined(__DOXYGEN__) */Which looks like all interrupt events which handler address is contained in IVOR 0-15 and IVOR 32-34 are linked to the predefined unhandled exception handler.
Does this mean that if any of those sources would raise its interrupt flag, that event will trigger the unhandled exception handler? I guess so..
So I need to check who's rasing an interrupt flag (not being supposed to do so), right?
Looking at the assembly code of the unhandled exception handler I think the reason why my application gets stuck is because the handler is just an endless loop..
And what if changed the unhandled exception so that it just returns from interrupt? Would that allow the application to go ahead?
Thank you.
Regards
Alessandro
举报