Repository navigation
fix(privilege): implement non-H MPRV and xRET handling - #7
Merged
RossComputerGuy merged 3 commits intoOct 6, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MPRV writes currently disappear, so M-mode loads and stores remain physical even with
MPRV=1, MPP=S. For example, ifsatpmaps VA0x20000to PA0x30000, the load incorrectly reads physical0x20000.This implements MPRV for non-H cores with U support:
Existing status aliases and the actual-mode DTLB flush policy are retained.
H support remains deferred
H-enabled cores retain their existing read-only-zero MPRV. This remains an architectural limitation. Supporting it requires coordinated MPP/MPV selection, separate fetch/data virtualization contexts and roots, VS SUM and host/VS MXR handling, HLV/HLVX/HSV overrides via SPVP, and correct VS xRET state/PC restoration. Guest-fetch translation is also outside this patch.
Testing
Compared against upstream
03df7bb:Coverage includes RV32/RV64 CSR behavior and RV64 Sv39 loads/stores with static and microcoded executors, with and without L1 caches. Tests exercise warm-cache permission changes, fetch isolation, and MRET-to-M behavior.
Changed production files retain the same nine analyzer diagnostics as baseline; new tests analyze cleanly. No full-suite or hardware validation was performed. The D-cache tags gain two permission bits; synthesis and FPGA timing have not been checked.