The mtval register is a read/write register. When a trap is taken into M-mode, mtval is either set to zero or written with exception-specific information to assist software in handling the trap.
| Code | Exception | Description |
|---|---|---|
| 0 | Instruction address misaligned | Set to the program counter of the misaligned access |
| 2 | Illegal instruction | Set to the instruction causing the exception |
| 3 | Breakpoint trap | Set to the program counter of the breakpoint |
| 4 | Load address misaligned | Set to the misaligned load address |
| 5 | Load access fault | Set to the address causing the access fault |
| 6 | Store/AMO address misaligned | Set to the misaligned store address |
| 7 | Store/AMO access fault | Set to the address causing the access fault |
| Other | Other events | Set to 0x00000000 |