Visible to Intel only — GUID: fhu1741140338817
Ixiasoft
Visible to Intel only — GUID: fhu1741140338817
Ixiasoft
4.3.11.1.4.4. Machine Cause Register (mcause)
The mcause register is a 32-bits wide register. When a trap is taken, mcause holds a code identifying the event that caused the trap.
Bit Fields | |||||||||||||||
31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
interrupt | minhv | mpp[1:0] = 00 | mpie | Reserved | mpil[7:0] | ||||||||||
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
Reserved | exccode[11:0] |
Bits | Field | Description |
---|---|---|
31 | interrupt | 0: Exception 1: Interrupt |
30 | minvh | 0: mepc contains (virtual) address of instruction |
29:28 | mpp[1:0] | Previous privilege mode. Same as mstatus.mpp |
27 | mpie | Previous interrupt enable. Same as mstatus.mpie |
26:24 | Reserved | - |
23:16 | mpil[7:0] | Previous interrupt level |
15:12 | Reserved | - |
11:0 | exccode[11:0] | Exception/interrupt code |
The mcause.mpp and mcause.mpie fields mirror the mstatus.mpp and mstatus.mpie fields to reduce context save/restore code. For backwards compatibility in implementations supporting both CLINT and CLIC modes, when switching to CLINT mode the new CLIC mcause.mpil state field is zeroed.
Interrupt | Exception Code | Description |
---|---|---|
1 | 3 | Machine software interrupt |
1 | 7 | Machine timer interrupt |
1 | 16-2064 | 2048 Platform interrupts, connected through irq[0:2047] interface.
For example:
|
1 | Others | Reserved |
0 | 0 | Instruction address misaligned |
0 | 1 | Instruction access fault |
0 | 2 | Illegal Instruction |
0 | 3 | Breakpoint |
0 | 4 | Load address misaligned |
0 | 5 | Load access fault |
0 | 6 | Store address misaligned |
0 | 7 | Store access fault |
0 | Others | Reserved |
If an instruction may raise multiple synchronous exceptions, the decreasing priority order indicates which exception is taken and reported in mcause.
Priority | Exception Code | Description |
---|---|---|
Highest | 3 | Instruction address breakpoint |
1 |
With physical address for instruction: Instruction access fault |
|
2 0 3 3 |
Illegal instruction Instruction address misaligned Environment break Load/Store address breakpoint |
|
4,6 |
Optionally: Load/Store address misaligned |
|
5,7 |
With physical address for an explicit memory access: Load/Store access fault |
|
Lowest | 4,6 | Load/Store address misaligned |