Skip to content

Commit

Permalink
Merge pull request #231 from rmsyn/riscv/cleanup-mcountinhibit
Browse files Browse the repository at this point in the history
riscv: re-use `mcountinhibit` `try_*` functions
  • Loading branch information
romancardenas authored Oct 25, 2024
2 parents 63b748a + bf766e1 commit 64957b3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions riscv/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Changed

- Use CSR helper macros to define `marchid` register
- Re-use `try_*` functions in `mcountinhibit`

## [v0.12.1] - 2024-10-20

Expand Down
6 changes: 2 additions & 4 deletions riscv/src/register/mcountinhibit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ set_clear_csr!(

#[inline]
pub unsafe fn set_hpm(index: usize) {
assert!((3..32).contains(&index));
_set(1 << index);
try_set_hpm(index).unwrap();
}

#[inline]
Expand All @@ -60,8 +59,7 @@ pub unsafe fn try_set_hpm(index: usize) -> Result<()> {

#[inline]
pub unsafe fn clear_hpm(index: usize) {
assert!((3..32).contains(&index));
_clear(1 << index);
try_clear_hpm(index).unwrap();
}

#[inline]
Expand Down

0 comments on commit 64957b3

Please sign in to comment.