← Home

mtval2

Machine Second Trap Value Register

Address: 0x34B (843) · Privilege: M · Length: MXLEN · Writable · Defined by: H

When a trap is taken into M-mode from a virtual mode, mtval2 is written with additional exception-specific information, alongside mtval, to assist software in handling the trap.

When a guest-page-fault trap is taken into M-mode, mtval2 is written with either zero or the guest physical address that faulted, shifted right by 2 bits. For other traps, mtval2 is set to zero, but a future standard or extension may redefine mtval2's setting for other traps.

If a guest-page fault is due to an implicit memory access during first-stage (VS-stage) address translation, a guest physical address written to mtval2 is that of the implicit memory access that faulted. Additional information is provided in CSR mtinst to disambiguate such situations.

Otherwise, for misaligned loads and stores that cause guest-page faults, a nonzero guest physical address in mtval2 corresponds to the faulting portion of the access as indicated by the virtual address in mtval. For instruction guest-page faults on systems with variable-length instructions, a nonzero mtval2 corresponds to the faulting portion of the instruction as indicated by the virtual address in mtval.

mtval2 is a WARL register that must be able to hold zero and may be capable of holding only an arbitrary subset of other 2-bit-shifted guest physical addresses, if any.

Fields

RV32

31:2423:1615:87:0
VALUE

RV64

63:5655:4847:4039:3231:2423:1615:87:0
VALUE
BitsFieldAliasDescriptionTypeReset
RV32 [31:0]
RV64 [63:0]
VALUEException-specific information for a trap into M-mode.
if (REPORT_GPA_IN_TVAL_ON_LOAD_GUEST_PAGE_FAULT
    || REPORT_GPA_IN_TVAL_ON_STORE_AMO_GUEST_PAGE_FAULT
    || REPORT_GPA_IN_TVAL_ON_INSTRUCTION_GUEST_PAGE_FAULT
    || REPORT_GPA_IN_TVAL_ON_INTERMEDIATE_GUEST_PAGE_FAULT) {
  return CsrFieldType::RWH;
} else {
  return CsrFieldType::RO;
}
UNDEFINED_LEGAL

Version af3eaf9+cheriot.f635218

Data from the RISC-V Unified Database, copyright RISC-V International and contributors.

CHERIoT extensions from the CHERIoT specification and Sail model, copyright Microsoft and the CHERIoT Platform contributors.

This site is provided as a community resource and is NOT affiliated with nor endorsed by RISC-V International.