views:

68

answers:

1

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?

+1  A: 

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

Joelmob