瀏覽代碼

feat: Add update_sum method to Sstatus struct (#8)

LoGin 3 周之前
父節點
當前提交
4241a97627
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      riscv/src/register/sstatus.rs

+ 9 - 0
riscv/src/register/sstatus.rs

@@ -99,6 +99,15 @@ impl Sstatus {
         self.bits & (1 << 18) != 0
     }
 
+    #[inline]
+    pub fn update_sum(&mut self, value: bool) {
+        if value {
+            self.bits |= 1 << 18;
+        } else {
+            self.bits &= !(1 << 18);
+        }
+    }
+
     /// Make eXecutable Readable
     #[inline]
     pub fn mxr(&self) -> bool {