vscause
Virtual Supervisor Cause
Reports the cause of the latest exception taken in VS-mode.
Attributes
CSR Address |
0x242 |
|---|---|
Virtual CSR Address |
0x142 |
Defining extension |
|
Length |
64-bit |
Privilege Mode |
VS |
Fields
INT
- Location
-
vscause[63] - Description
-
Written by hardware when a trap is taken into VS-mode.
When set, the last exception was caused by an asynchronous Interrupt.
vscause.INT is writable.
If vscause is written with an undefined cause (combination of vscause.INT and vscause.CODE), an
Illegal Instructionexception occurs.If vscause is written with an undefined cause (combination of vscause.INT and vscause.CODE), neither vscause.INT nor vscause.CODE are modified.
- Type
RW-RH |
Read-Write Restricted with Hardware update Field is writable by software. Only certain values are legal. Writing an illegal value into the field is ignored, such that the field retains its prior state. Hardware also updates the field without an explicit software write.) |
- Reset value
-
UNDEFINED_LEGAL
- Software write
-
This field has special behavior when written by software (e.g., through csrrw).
When software tries to write
csr_value, the field will be written with the return value of the function below.if (csr_value.INT == 1) { if (valid_interrupt_code?(csr_value.CODE)) { return 1; } return ILLEGAL_WLRL; } else { if (valid_exception_code?(csr_value.CODE)) { return 1; } return ILLEGAL_WLRL; }
CODE
- Location
-
vscause[62:0] - Description
-
Written by hardware when a trap is taken into VS-mode.
Holds the interrupt or exception code for the last taken trap.
vscause.CODE is writable.
If vscause is written with an undefined cause (combination of vscause.INT and vscause.CODE), an
Illegal Instructionexception occurs.If vscause is written with an undefined cause (combination of vscause.INT and vscause.CODE), neither vscause.INT nor vscause.CODE are modified.
Valid interrupt codes are:
0 |
InstructionAddressMisaligned |
1 |
InstructionAccessFault |
2 |
IllegalInstruction |
3 |
Breakpoint |
4 |
LoadAddressMisaligned |
5 |
LoadAccessFault |
6 |
StoreAmoAddressMisaligned |
7 |
StoreAmoAccessFault |
8 |
Ucall |
9 |
Scall |
10 |
VScall |
11 |
Mcall |
12 |
InstructionPageFault |
13 |
LoadPageFault |
15 |
StoreAmoPageFault |
16 |
DoubleTrap |
18 |
SoftwareCheck |
19 |
HardwareError |
20 |
InstructionGuestPageFault |
21 |
LoadGuestPageFault |
22 |
VirtualInstruction |
23 |
StoreAmoGuestPageFault |
+ Valid exception codes are:
0 |
InstructionAddressMisaligned |
1 |
InstructionAccessFault |
2 |
IllegalInstruction |
3 |
Breakpoint |
4 |
LoadAddressMisaligned |
5 |
LoadAccessFault |
6 |
StoreAmoAddressMisaligned |
7 |
StoreAmoAccessFault |
8 |
Ucall |
9 |
Scall |
10 |
VScall |
11 |
Mcall |
12 |
InstructionPageFault |
13 |
LoadPageFault |
15 |
StoreAmoPageFault |
16 |
DoubleTrap |
18 |
SoftwareCheck |
19 |
HardwareError |
20 |
InstructionGuestPageFault |
21 |
LoadGuestPageFault |
22 |
VirtualInstruction |
23 |
StoreAmoGuestPageFault |
- Type
RW-RH |
Read-Write Restricted with Hardware update Field is writable by software. Only certain values are legal. Writing an illegal value into the field is ignored, such that the field retains its prior state. Hardware also updates the field without an explicit software write.) |
- Reset value
-
UNDEFINED_LEGAL
- Software write
-
This field has special behavior when written by software (e.g., through csrrw).
When software tries to write
csr_value, the field will be written with the return value of the function below.if (csr_value.INT == 1) { if (valid_interrupt_code?(csr_value.CODE)) { return csr_value.CODE; } return ILLEGAL_WLRL; } else { if (valid_exception_code?(csr_value.CODE)) { return csr_value.CODE; } return ILLEGAL_WLRL; }