You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After modifying PMP configurations, SFENCE.VMA and HFENCE.GVMA instructions are required on XiangShan, as it implements page-based virtual memory.
There is a statement in RISC-V Privileged Architecture Manual / Machine-Level ISA / Physical Memory Protection / Physical Memory Protection and Paging:
... when the PMP settings are modified, M-mode software must synchronize the PMP settings with the virtual memory system and any PMP or address-translation caches. This is accomplished by executing an SFENCE.VMA instruction with rs1=x0 and rs2=x0, after the PMP CSRs are written. ...
If page-based virtual memory is not implemented, memory accesses check the PMP settings synchronously, so no SFENCE.VMA is needed.
There is supplementary explanation in changes log about "page-based virtual memory is not implemented":
PMP changes require an SFENCE.VMA on any hart that implements page-based virtual memory, even if VM is not currently enabled.
A complementary explanation: NEMU does not have detailed structures like ICache or TLB, so it is really hard to align NEMU with XS in such circumstances :(
Before start
Describe the bug
After setting PMP region, inconsistency behavior occurred.
Expected behavior
No consistence.
To Reproduce
_start:
li t0, 0x70020000
csrw pmpaddr0, t0
li t1, 0x88
csrw pmpcfg0, t1
li t1, 0x1
mret
Environment
Additional context
No response
The text was updated successfully, but these errors were encountered: