浏览代码

dynamic: update definition of dynamic information

Ref: https://github.com/riscv-software-src/opensbi/blob/019a8e69a1dc0c0f011fabd0372e1ba80e40dd7c/include/sbi/fw_dynamic.h#L28

Signed-off-by: Zhouqi Jiang <luojia@hust.edu.cn>
Zhouqi Jiang 10 月之前
父节点
当前提交
7cba717df0
共有 2 个文件被更改,包括 7 次插入2 次删除
  1. 5 0
      src/dynamic.rs
  2. 2 2
      src/fail.rs

+ 5 - 0
src/dynamic.rs

@@ -18,8 +18,13 @@ pub struct DynamicInfo {
     pub next_mode: usize,
     /// M-mode firmware options; its definition varies between SBI implementations.
     pub options: usize,
+    /// Boot hart ID of current environment.
+    pub boot_hart: usize,
 }
 
+// Definition of `boot_hart` can be found at:
+// https://github.com/riscv-software-src/opensbi/blob/019a8e69a1dc0c0f011fabd0372e1ba80e40dd7c/include/sbi/fw_dynamic.h#L75
+
 const DYNAMIC_INFO_VALID_ADDRESSES: Range<usize> = 0x1000..0xf000;
 const NEXT_ADDR_VALID_ADDRESSES: Range<usize> = 0x80000000..0x90000000;
 

+ 2 - 2
src/fail.rs

@@ -17,8 +17,8 @@ pub fn invalid_dynamic_info(err: dynamic::DynamicError) -> (mstatus::MPP, usize)
         _ => "Invalid",
     };
     error!(
-        "help: dynamic information contains magic value 0x{:x}, version {}, next jump address 0x{:x}, next privilege mode {} ({}), options {:x}",
-        err.bad_info.magic, err.bad_info.version, err.bad_info.next_addr, err.bad_info.next_mode, explain_next_mode, err.bad_info.options
+        "help: dynamic information contains magic value 0x{:x}, version {}, next jump address 0x{:x}, next privilege mode {} ({}), options {:x}, boot hart ID {}",
+        err.bad_info.magic, err.bad_info.version, err.bad_info.next_addr, err.bad_info.next_mode, explain_next_mode, err.bad_info.options, err.bad_info.boot_hart
     );
     reset::fail()
 }