@@ -1,10 +0,0 @@
-{
- // Prevent error "can't find crate for `test`" in no_std
- // Ref: https://github.com/rust-lang/vscode-rust/issues/729
- // For vscode-rust plugin user:
- "rust.target": "riscv64imac-unknown-none-elf",
- "rust.all_targets": false,
- // For Rust Analyzer:
- "rust-analyzer.cargo.target": "riscv64imac-unknown-none-elf",
- "rust-analyzer.checkOnSave.allTargets": false
-}
@@ -10,6 +10,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### Added
- Instance based and/or machine independent RustSBI to support hypervisor development
+- Structure `MachineInfo` for non-machine environment, e.g. cross-architecture emulator
- Feature `legacy` to gate SBI legacy extension
- Expose `init_*` functions on instance based RustSBI implementation
- LEGACY_CLEAR_IPI implemented
@@ -50,6 +50,29 @@ impl<T: Timer, I: Ipi, R: Fence, H: Hsm, S: Reset, P: Pmu> RustSBI<T, I, R, H, S
}
+ /// Create RustSBI instance on given machine information for all the SBI extensions
+ #[cfg(not(feature = "machine"))]
+ #[inline]
+ pub const fn with_machine_info(
+ timer: T,
+ ipi: I,
+ rfnc: R,
+ hsm: H,
+ srst: S,
+ pmu: P,
+ info: MachineInfo,
+ ) -> Self {
+ Self {
+ timer: Some(timer),
+ ipi: Some(ipi),
+ rfnc: Some(rfnc),
+ hsm: Some(hsm),
+ srst: Some(srst),
+ pmu: Some(pmu),
+ info,
+ }
+
/// Handle supervisor environment call with given parameters and return the `SbiRet` result.
#[inline]
pub fn handle_ecall(&mut self, extension: usize, function: usize, param: [usize; 6]) -> SbiRet {