MIPS汇编判断硬件I/O中断是否发生?
在我的 MIPS32 异常处理程序中,我想确定异常是否是由 I/O 中断引起的。必须检查原因寄存器的第 2-6 位(含)。确定这一点的 MIPS 汇编代码是什么?
In my MIPS32 exception handler, I want to determine whether the exception was caused by a I/O interrupt. The Cause register bits 2-6 inclusive has to be checked. What's the MIPS assembly code to determine this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你必须屏蔽掉每一位来检查中断来自哪里。异常处理程序过程如下所示:
您可以查看硬件手册,其中说明了中断来自何处,并且经常有错误代码,您可以将其加载到寄存器中并与 EPIE 寄存器进行比较,以查看异常是否是陷阱或中断,请记住重置 EPIE(错误状态寄存器),然后从错误返回并启用处理器控制寄存器中的中断位以允许硬件发出中断。
这是我在为 Nios II 编写异常处理程序时使用的方案,该过程对于 MIPS32 应该类似。
MIPS 汇编语言、MIPS:中断和异常第 22 页
You have to mask out each bit to check where the interrupt came from. The exception handler procedure is shown here:
You can see the manual for your hardware that says where the interrupt came from and theres often error codes that u can load into a register and compare with the EPIE register to see if the exception was a trap or interrupt, remember to reset the EPIE (error status register) before you return from the error and enable the interrupt bits in the processors control register to allow the hardware to make interrupts.
This is the scheme i used when coding an exception handler for Nios II, the procedure should be similar for MIPS32.
MIPS assembly language, MIPS: Interrupts and Exceptions page 22