Skip to content

Commit

Permalink
Merge pull request #149 from rust-embedded/remove-fcsr
Browse files Browse the repository at this point in the history
Remove FCSR
  • Loading branch information
MabezDev authored Nov 7, 2023
2 parents 051a80a + b48bfb9 commit 4ab67d6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 139 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Removed

- User mode registers removed, as they are no longer supported in RISC-V
- FCSR register operations removed to avoid UB (#148)

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

Expand Down
30 changes: 25 additions & 5 deletions src/register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,35 @@
//! - minstreth
//! - mhpmcounter<3-31>h
//! - mstatush
//!
//! # On Floating-Point CSRs
//!
//! We are deliberately *not* providing instructions that could change the floating-point rounding
//! mode or exception behavior or read the accrued exceptions flags: `frcsr`, `fscsr`, `fsrm`,
//! `frflags`, `fsflags`.
//!
//! Rust makes no guarantees whatsoever about the contents of the accrued exceptions register: Rust
//! floating-point operations may or may not result in this register getting updated with exception
//! state, and the register can change between two invocations of this function even when no
//! floating-point operations appear in the source code (since floating-point operations appearing
//! earlier or later can be reordered).
//!
//! Modifying the rounding mode leads to **immediate Undefined Behavior**: Rust assumes that the
//! default rounding mode is always set and will optimize accordingly. This even applies when the
//! rounding mode is altered and later reset to its original value without any floating-point
//! operations appearing in the source code between those operations (since floating-point
//! operations appearing earlier or later can be reordered).
//!
//! If you need to perform some floating-point operations and check whether they raised an
//! exception, use a single inline assembly block for the entire sequence of operations.
//!
//! If you need to perform some floating-point operations under a different rounding mode, use a
//! single inline assembly block and make sure to restore the original rounding mode before the end
//! of the block.
#[macro_use]
mod macros;

// User Floating-Point CSRs
// TODO: frm, fflags
pub mod fcsr;

// User Counter/Timers
pub mod cycle;
pub mod cycleh;
Expand All @@ -29,7 +50,6 @@ pub mod time;
pub mod timeh;

// Supervisor Trap Setup
// TODO: sedeleg, sideleg
pub mod scounteren;
pub mod sie;
pub mod sstatus;
Expand Down
134 changes: 0 additions & 134 deletions src/register/fcsr.rs

This file was deleted.

0 comments on commit 4ab67d6

Please sign in to comment.