vstvec

Virtual Supervisor Trap Vector

Controls where traps jump.

Attributes

Requirement

H

Defining extensions

H

Hypervisor

CSR Address

0x205

Virtual CSR Address

0x105

Length

* 32 when CSR[hstatus].VSXL == 0 * 64 when CSR[hstatus].VSXL == 1

Privilege Mode

VS

Format

This CSR format changes dynamically.

vstvec Format when CSR[hstatus].VSXL == 0
Figure 1. vstvec Format when CSR[hstatus].VSXL == 0
vstvec Format when CSR[hstatus].VSXL == 1
Figure 2. vstvec Format when CSR[hstatus].VSXL == 1

Field Summary

Name Location Type Reset Value

vstvec.BASE

* 31:2 when CSR[hstatus].VSXL == 0 * 63:2 when CSR[hstatus].VSXL == 1

RW-R

0

vstvec.MODE

1:0

[when,"$array_size(VSTVEC_MODES) == 1"] RO

[when,"$array_size(VSTVEC_MODES) != 1"] RW-R

UNDEFINED_LEGAL

Fields

BASE

Location
  • 31:2 when CSR[hstatus].VSXL == 0

  • 63:2 when CSR[hstatus].VSXL == 1

Description

<%- va_size = ext?(:Sv57) ? 57 : (ext?(:Sv48) ? 48 : 39) -%> Bits [VSXLEN-1:2] of the virtual address of the exception vector for any trap taken into VS-mode.

If the base address is written with a non-canonical address (i.e., bits [VSXLEN-1:<%= va_size %>] do not match bit <%= va_size-1 %>), the write should be ignored.

Type

RW-R

Reset value

0

MODE

Location

1:0

Description

Vectoring mode for asynchronous interrupts taken into VS-mode.

0 - Direct, 1 - Vectored

When Direct, all synchronous exceptions and asynchronous interrupts jump to (vstvec.BASE << 2).

When Vectored, asynchronous interrupts jump to (vstvec.BASE << 2 + vscause.CODE*4) while synchronous exceptions continue to jump to (vstvec.BASE << 2).

Type

RO

RW-R

Reset value

UNDEFINED_LEGAL

Software write

This CSR may store a value that is different from what software attempts to write.

When a software write occurs (e.g., through csrrw), the following determines the written value:

BASE = # Base spec says that BASE must be 4-byte aligned, which will always be the case
# implementations may put further constraints on BASE when MODE != Direct
# If that is the case, vstvec should have an override for the implementation
return csr_value.BASE;

MODE = if ($array_includes?(VSTVEC_MODES, csr_value.MODE)) {
  return csr_value.MODE;
}
return UNDEFINED_LEGAL_DETERMINISTIC;