diff --git a/riscv/CHANGELOG.md b/riscv/CHANGELOG.md index d4631063..ad369045 100644 --- a/riscv/CHANGELOG.md +++ b/riscv/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +### Changed + +- Re-use `try_*` functions in `mcountinhibit` + ## [v0.12.0] - 2024-10-19 ### Added diff --git a/riscv/src/register/mcountinhibit.rs b/riscv/src/register/mcountinhibit.rs index daa71c67..a3895124 100644 --- a/riscv/src/register/mcountinhibit.rs +++ b/riscv/src/register/mcountinhibit.rs @@ -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] @@ -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]