commons.rs 855 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Mock implementaion module. Actual SBI implementaion should implement
  2. // those SBI extensions with machine environment specific hardware features.
  3. use rustsbi::{EnvInfo, HartMask};
  4. use sbi_spec::binary::SbiRet;
  5. pub struct MyFence;
  6. impl rustsbi::Fence for MyFence {
  7. fn remote_fence_i(&self, _: HartMask) -> SbiRet {
  8. println!("MyFence remote_fence_i function is called!");
  9. SbiRet::success(0)
  10. }
  11. fn remote_sfence_vma(&self, _: HartMask, _: usize, _: usize) -> SbiRet {
  12. todo!()
  13. }
  14. fn remote_sfence_vma_asid(&self, _: HartMask, _: usize, _: usize, _: usize) -> SbiRet {
  15. todo!()
  16. }
  17. }
  18. pub struct MyEnvInfo;
  19. impl EnvInfo for MyEnvInfo {
  20. fn mvendorid(&self) -> usize {
  21. 0x100
  22. }
  23. fn marchid(&self) -> usize {
  24. 0x200
  25. }
  26. fn mimpid(&self) -> usize {
  27. 0x300
  28. }
  29. }