Order writes before sfence
The `sfence.w.inval` instruction guarantees that any previous stores already visible to the current RISC-V hart are ordered before subsequent `sinval.vma` instructions executed by the same hart.
sfence.w.inval
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 000 | 11 | 00000000000000000000 | 111 | 00 | 11 | ||||||||||||||||||||||||||
if (mode() == PrivilegeMode::U) {
raise (ExceptionCode::IllegalInstruction, mode(), $encoding);
}
if (CSR[misa].H == 1 && mode() == PrivilegeMode::VU) {
raise (ExceptionCode::VirtualInstruction, mode(), $encoding);
}
# order all prior stores already visible to the current hart
# before any following sfence
# Unlike SFENCE.VMA/HFENCE.[GV]VMA, SFENCE.W.INVAL is indiscriminate;
# it orders all writes before all page tables
VmaOrderType vma_type;
vma_type.global = true;
vma_type.smode = true;
if (CSR[misa].H == 1) {
vma_type.vsmode = true;
vma_type.gstage = true;
}
order_pgtbl_writes_before_vmafence(vma_type);
Svinval
| S | U | VS | VU |
|---|---|---|---|
| Sometimes | Never | Sometimes | Never |
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.