MIPS汇编判断硬件I/O中断是否发生?

发布于 2024-08-30 13:15:24 字数 88 浏览 6 评论 0原文

在我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

如日中天 2024-09-06 13:15:24

你必须屏蔽掉每一位来检查中断来自哪里。异常处理程序过程如下所示: ExcHandler

您可以查看硬件手册,其中说明了中断来自何处,并且经常有错误代码,您可以将其加载到寄存器中并与 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: ExcHandler

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文