exceptionmipsmips32

Cause register's value in MIPS32 architecture


If the value in the cause register is, for example, 0x00000100, how can I obtain the type of exception that has generated that code?(from the table below)

0 Int interrupt (hardware)

4 AdEL address error exception (load or instruction fetch)

5 AdES address error exception (store)

6 IBE bus error on instruction fetch

7 DBE bus error on data load or store

8 Sys syscall exception

9 Bp breakpoint exception

10 RI reserved instruction exception

11 CpU coprocessor unimplemented

12 Ov arithmetic overfl ow exception

13 Tr trap

15 FPE fl oating point

Solution

  • This is described in the section named 6.16 Cause Register (CP0 Register 13, Select 0) in MIPS32™ Architecture For Programmers Volume III: The MIPS32™ Privileged Resource Architecture.

    Cause Register Format

    31 | 30 | 29  28 | 27 24 | 23 | 22 | 21 16 | 15  8 | 7 | 6       2 | 1 0
    
    ------------------------------------------------------------------------
    BD | 0  |   CE   |   0   | IV | WP  |  0   |   IP  | 0 |  ExcCode  |  0
    
     IP[1:0]  Controls the request for software interrupts
    

    In your example with 0x100, that means that only IP0 (bit 8) of the cause register is set, which means that the cause was a software interrupt request (software interrupt 0 to be specific).