← Home

sfence.w.inval

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.

Assembly format

sfence.w.inval

Encoding

313029282726252423222120191817161514131211109876543210
00011000000000000000000001110011

Execution

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);

Defined by

Svinval

Access

SUVSVU
SometimesNeverSometimesNever

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.