ソースを参照

Small fix for private a1 value on HSM module

luojia65 4 年 前
コミット
850f67d1f5
2 ファイル変更6 行追加5 行削除
  1. 2 2
      rustsbi/src/ecall/hsm.rs
  2. 4 3
      rustsbi/src/hsm.rs

+ 2 - 2
rustsbi/src/ecall/hsm.rs

@@ -16,8 +16,8 @@ pub fn handle_ecall_hsm(function: usize, param0: usize, param1: usize, param2: u
 }
 
 #[inline]
-fn hart_start(hartid: usize, start_addr: usize, priv_: usize) -> SbiRet {
-    crate::hsm::hart_start(hartid, start_addr, priv_)
+fn hart_start(hartid: usize, start_addr: usize, private_value: usize) -> SbiRet {
+    crate::hsm::hart_start(hartid, start_addr, private_value)
 }
 
 #[inline]

+ 4 - 3
rustsbi/src/hsm.rs

@@ -2,7 +2,8 @@ use crate::ecall::SbiRet;
 
 /// Hart State Management Extension
 pub trait Hsm: Send {
-    fn hart_start(&mut self, hartid: usize, start_addr: usize, priv_: usize) -> SbiRet;
+    // Should pass `private_value` to register a1
+    fn hart_start(&mut self, hartid: usize, start_addr: usize, private_value: usize) -> SbiRet;
 
     fn hart_stop(&mut self, hartid: usize) -> SbiRet;
 
@@ -27,9 +28,9 @@ pub(crate) fn probe_hsm() -> bool {
     HSM.lock().as_ref().is_some()
 }
 
-pub(crate) fn hart_start(hartid: usize, start_addr: usize, priv_: usize) -> SbiRet {
+pub(crate) fn hart_start(hartid: usize, start_addr: usize, private_value: usize) -> SbiRet {
     if let Some(obj) = &mut *HSM.lock() {
-        return obj.hart_start(hartid, start_addr, priv_);
+        return obj.hart_start(hartid, start_addr, private_value);
     }
     SbiRet::not_supported()
 }