Browse Source

fix: `hart_stop` can only stop the calling hart

YdrMaster 2 years ago
parent
commit
c3651f836b
2 changed files with 6 additions and 6 deletions
  1. 3 3
      src/ecall/hsm.rs
  2. 3 3
      src/hsm.rs

+ 3 - 3
src/ecall/hsm.rs

@@ -10,7 +10,7 @@ const FUNCTION_HSM_HART_SUSPEND: u32 = 0x3;
 pub fn handle_ecall_hsm(function: u32, param0: usize, param1: usize, param2: usize) -> SbiRet {
     match function {
         FUNCTION_HSM_HART_START => hart_start(param0, param1, param2),
-        FUNCTION_HSM_HART_STOP => hart_stop(param0),
+        FUNCTION_HSM_HART_STOP => hart_stop(),
         FUNCTION_HSM_HART_GET_STATUS => hart_get_status(param0),
         FUNCTION_HSM_HART_SUSPEND => hart_suspend(param0, param1, param2),
         _ => SbiRet::not_supported(),
@@ -23,8 +23,8 @@ fn hart_start(hartid: usize, start_addr: usize, opaque: usize) -> SbiRet {
 }
 
 #[inline]
-fn hart_stop(hartid: usize) -> SbiRet {
-    crate::hsm::hart_stop(hartid)
+fn hart_stop() -> SbiRet {
+    crate::hsm::hart_stop()
 }
 
 #[inline]

+ 3 - 3
src/hsm.rs

@@ -93,7 +93,7 @@ pub trait Hsm: Send {
     /// | Error code  | Description
     /// |:------------|:------------
     /// | SBI_ERR_FAILED | Failed to stop execution of the current hart
-    fn hart_stop(&self, hartid: usize) -> SbiRet;
+    fn hart_stop(&self) -> SbiRet;
     /// Get the current status (or HSM state id) of the given hart.
     ///
     /// The harts may transition HSM states at any time due to any concurrent `sbi_hart_start()`
@@ -215,9 +215,9 @@ pub(crate) fn hart_start(hartid: usize, start_addr: usize, opaque: usize) -> Sbi
     SbiRet::not_supported()
 }
 
-pub(crate) fn hart_stop(hartid: usize) -> SbiRet {
+pub(crate) fn hart_stop() -> SbiRet {
     if let Some(obj) = HSM.get() {
-        return obj.hart_stop(hartid);
+        return obj.hart_stop();
     }
     SbiRet::not_supported()
 }