Browse Source

Implement Mstatus.bits()

David Reiss 2 months ago
parent
commit
b3c100a8e2
2 changed files with 7 additions and 0 deletions
  1. 1 0
      riscv/CHANGELOG.md
  2. 6 0
      riscv/src/register/mstatus.rs

+ 1 - 0
riscv/CHANGELOG.md

@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
 ### Added
 
 - Add `Mcause::from(usize)` for use in unit tests
+- Add `Mstatus.bits()`
 
 ### Fixed
 

+ 6 - 0
riscv/src/register/mstatus.rs

@@ -65,6 +65,12 @@ impl From<bool> for Endianness {
 }
 
 impl Mstatus {
+    /// Returns the contents of the register as raw bits
+    #[inline]
+    pub fn bits(&self) -> usize {
+        self.bits
+    }
+
     /// Supervisor Interrupt Enable
     #[inline]
     pub fn sie(&self) -> bool {