Skip to content

Commit ec99d03

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

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1010
### Added
1111

1212
- Add `asm::fence()`, a wrapper for implementing a `fence` instruction
13+
- Add `asm::fence_i()`, a wrapper for implementing a `fence.i` instruction
1314

1415
## [v0.10.1] - 2023-01-18
1516

src/asm.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,24 @@ instruction!(
5555
/// memory reads and writes made by an external device. However, FENCE does not order observations
5656
/// of events made by an external device using any other signaling mechanism.
5757
, fence, "fence");
58+
instruction!(
59+
/// `FENCE.I` instruction wrapper
60+
///
61+
/// Used to synchronize the instruction and data streams. RISC-V does not guarantee that
62+
/// stores to instruction memory will be made visible to instruction fetches on a
63+
/// RISC-V hart until that hart executes a FENCE.I instruction.
64+
///
65+
/// A FENCE.I instruction ensures that a subsequent instruction fetch on a RISC-V hart
66+
/// will see any previous data stores already visible to the same RISC-V hart.
67+
/// FENCE.I does not ensure that other RISC-V harts’ instruction fetches will observe the
68+
/// local hart’s stores in a multiprocessor system. To make a store to instruction memory
69+
/// visible to all RISC-V harts, the writing hart also has to execute a data FENCE before
70+
/// requesting that all remote RISC-V harts execute a FENCE.I.
71+
///
72+
/// The unused fields in the FENCE.I instruction, imm[11:0], rs1, and rd, are reserved for
73+
/// finer-grain fences in future extensions. For forward compatibility, base
74+
/// implementations shall ignore these fields, and standard software shall zero these fields.
75+
, fence_i, "fence.i");
5876

5977
/// `SFENCE.VMA` instruction wrapper
6078
///

0 commit comments

Comments
 (0)