Skip to content

Commit 539d4b7

Browse files
Merge pull request #180 from jsgf/safe-fence
Make fence operations safe
2 parents ac437cb + bb5ce67 commit 539d4b7

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

riscv/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+
### Changed
11+
12+
- Made `asm::fence`, `fence_i` and `sfence` safe (ie, removed `unsafe` from their definitions)
13+
1014
## [v0.11.0] - 2024-01-14
1115

1216
### Added

riscv/src/asm.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ instruction!(
5757
/// are ordinarily not ordered with respect to loads and stores in the instruction stream.
5858
/// Executing an `SFENCE.VMA` instruction guarantees that any stores in the instruction stream prior to the
5959
/// `SFENCE.VMA` are ordered before all implicit references subsequent to the `SFENCE.VMA`.
60-
, unsafe sfence_vma_all, "sfence.vma");
60+
, sfence_vma_all, "sfence.vma");
6161
instruction!(
6262
/// `FENCE` instruction wrapper
6363
///
@@ -71,7 +71,7 @@ instruction!(
7171
/// The FENCE instruction also orders memory reads and writes made by the hart as observed by
7272
/// memory reads and writes made by an external device. However, FENCE does not order observations
7373
/// of events made by an external device using any other signaling mechanism.
74-
, unsafe fence, "fence");
74+
, fence, "fence");
7575
instruction!(
7676
/// `FENCE.I` instruction wrapper
7777
///
@@ -89,7 +89,7 @@ instruction!(
8989
/// The unused fields in the FENCE.I instruction, imm\[11:0\], rs1, and rd, are reserved for
9090
/// finer-grain fences in future extensions. For forward compatibility, base
9191
/// implementations shall ignore these fields, and standard software shall zero these fields.
92-
, unsafe fence_i, "fence.i");
92+
, fence_i, "fence.i");
9393

9494
/// `SFENCE.VMA` instruction wrapper
9595
///

0 commit comments

Comments
 (0)