vsatp
Virtual Supervisor Address Translation and Protection
The vsatp register is a VSXLEN-bit read/write register that is VS-mode’s version of supervisor register satp. When V=1, vsatp substitutes for the usual satp, so instructions that normally read or modify satp actually access vsatp instead. vsatp controls VS-stage address translation, the first stage of two-stage translation for guest virtual addresses.
The vsatp register is considered active for the purposes of the address-translation algorithm unless the effective privilege mode is U and hstatus.HU=0. However, even when vsatp is active, VS-stage page-table entries' A bits must not be set as a result of speculative execution, unless the effective privilege mode is VS or VU.
In particular, virtual-machine load/store (hlv , 'hlvx', or 'hsv') instructions that are
misspeculatively executed must not cause VS-stage A bits to be set.
|
Attributes
CSR Address |
0x280 |
---|---|
Virtual CSR Address |
0x180 |
Defining extension |
|
Length |
64-bit |
Privilege Mode |
VS |
Fields
MODE
- Location
-
vsatp[63:60]
- Description
-
Translation Mode
Controls the current translation mode in VS-mode according to the table below.
Value
Name
Description +
0
Bare
No translation → virtual address == physical address
8
Sv39
39-bit virtual address translation
9
Sv48
48-bit virtual address translation
Any other value shall be ignored on a write.
- Type
RW-R |
Read-Write Restricted Field is writable by software. Only certain values are legal. Writing an illegal value into the field is ignored, and the field retains its prior state. |
- 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.MODE == 0) { if (virtual_mode?() || IGNORE_INVALID_VSATP_MODE_WRITES_WHEN_V_EQ_ZERO) { if (csr_value.ASID == 0 && csr_value.PPN == 0) { return csr_value.MODE; } else { return UNDEFINED_LEGAL_DETERMINISTIC; } } else { return UNDEFINED_LEGAL_DETERMINISTIC; } } else if (true && csr_value.MODE == 8) { return csr_value.MODE; } else if (true && csr_value.MODE == 9) { return csr_value.MODE; } else { return UNDEFINED_LEGAL_DETERMINISTIC; }
ASID
- Location
-
vsatp[59:44]
- Description
-
Address Space ID
- Type
RW-R |
Read-Write Restricted Field is writable by software. Only certain values are legal. Writing an illegal value into the field is ignored, and the field retains its prior state. |
- 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.MODE == 0) { if (virtual_mode?() || IGNORE_INVALID_VSATP_MODE_WRITES_WHEN_V_EQ_ZERO) { if (csr_value.ASID == 0 && csr_value.PPN == 0) { return csr_value.ASID; } else { return UNDEFINED_LEGAL_DETERMINISTIC; } } else { return UNDEFINED_LEGAL_DETERMINISTIC; } } else { XReg shamt = 16; XReg all_ones = (0xffff); XReg largest_allowed_asid = 0xffff; if (csr_value.ASID == all_ones) { return largest_allowed_asid; } else if (csr_value.ASID > largest_allowed_asid) { return UNDEFINED_LEGAL_DETERMINISTIC; } else { return csr_value.ASID; } }
PPN
- Location
-
vsatp[43:0]
- Description
-
Physical Page Number
The physical address of the active root page table is PPN << 12.
Can only hold values that correspond to a valid page table base, which will be implementation-dependent.
- Type
RW-R |
Read-Write Restricted Field is writable by software. Only certain values are legal. Writing an illegal value into the field is ignored, and the field retains its prior state. |
- 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.MODE == 0) { if (virtual_mode?() || IGNORE_INVALID_VSATP_MODE_WRITES_WHEN_V_EQ_ZERO) { if (csr_value.ASID == 0 && csr_value.PPN == 0) { return csr_value.PPN; } else { return UNDEFINED_LEGAL_DETERMINISTIC; } } else { return UNDEFINED_LEGAL_DETERMINISTIC; } } else { return csr_value.PPN; }