Skip to content

Commit

Permalink
Merge pull request #180 from jsgf/safe-fence
Browse files Browse the repository at this point in the history
Make fence operations safe
  • Loading branch information
romancardenas authored Feb 15, 2024
2 parents ac437cb + bb5ce67 commit 539d4b7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions riscv/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Changed

- Made `asm::fence`, `fence_i` and `sfence` safe (ie, removed `unsafe` from their definitions)

## [v0.11.0] - 2024-01-14

### Added
Expand Down
6 changes: 3 additions & 3 deletions riscv/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ instruction!(
/// are ordinarily not ordered with respect to loads and stores in the instruction stream.
/// Executing an `SFENCE.VMA` instruction guarantees that any stores in the instruction stream prior to the
/// `SFENCE.VMA` are ordered before all implicit references subsequent to the `SFENCE.VMA`.
, unsafe sfence_vma_all, "sfence.vma");
, sfence_vma_all, "sfence.vma");
instruction!(
/// `FENCE` instruction wrapper
///
Expand All @@ -71,7 +71,7 @@ instruction!(
/// The FENCE instruction also orders memory reads and writes made by the hart as observed by
/// memory reads and writes made by an external device. However, FENCE does not order observations
/// of events made by an external device using any other signaling mechanism.
, unsafe fence, "fence");
, fence, "fence");
instruction!(
/// `FENCE.I` instruction wrapper
///
Expand All @@ -89,7 +89,7 @@ instruction!(
/// The unused fields in the FENCE.I instruction, imm\[11:0\], rs1, and rd, are reserved for
/// finer-grain fences in future extensions. For forward compatibility, base
/// implementations shall ignore these fields, and standard software shall zero these fields.
, unsafe fence_i, "fence.i");
, fence_i, "fence.i");

/// `SFENCE.VMA` instruction wrapper
///
Expand Down

0 comments on commit 539d4b7

Please sign in to comment.