Skip to content

Commit 7b87638

Browse files
bors[bot]rmsyn
andauthored
Merge #128
128: Add FENCE instruction r=almindor a=rmsyn Co-authored-by: rmsyn <[email protected]>
2 parents b359b07 + a9cbf06 commit 7b87638

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Add `asm::fence()`, a wrapper for implementing a `fence` instruction
13+
1014
## [v0.10.1] - 2023-01-18
1115

1216
### Fixed

src/asm.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,20 @@ instruction!(
4141
/// Executing an `SFENCE.VMA` instruction guarantees that any stores in the instruction stream prior to the
4242
/// `SFENCE.VMA` are ordered before all implicit references subsequent to the `SFENCE.VMA`.
4343
, sfence_vma_all, "sfence.vma");
44+
instruction!(
45+
/// `FENCE` instruction wrapper
46+
///
47+
/// The FENCE instruction is used to order device I/O and memory accesses as viewed by other RISC-V
48+
/// harts and external devices or coprocessors. Any combination of device input (I), device output
49+
/// (O), memory reads (R), and memory writes (W) may be ordered with respect to any combination
50+
/// of the same. Informally, no other RISC-V hart or external device can observe any operation in the
51+
/// successor set following a FENCE before any operation in the predecessor set preceding the FENCE.
52+
/// Chapter 17 provides a precise description of the RISC-V memory consistency model.
53+
///
54+
/// The FENCE instruction also orders memory reads and writes made by the hart as observed by
55+
/// memory reads and writes made by an external device. However, FENCE does not order observations
56+
/// of events made by an external device using any other signaling mechanism.
57+
, fence, "fence");
4458

4559
/// `SFENCE.VMA` instruction wrapper
4660
///

0 commit comments

Comments
 (0)