4
0

commons.rs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Mock implementaion module. Actual SBI implementaion should implement
  2. // those SBI extensions with machine environment specific hardware features.
  3. use rustsbi::EnvInfo;
  4. use sbi_spec::binary::{HartMask, 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. fn remote_hfence_gvma_vmid(&self, _: HartMask, _: usize, _: usize, _: usize) -> SbiRet {
  18. todo!()
  19. }
  20. fn remote_hfence_gvma(&self, _: HartMask, _: usize, _: usize) -> SbiRet {
  21. todo!()
  22. }
  23. fn remote_hfence_vvma_asid(&self, _: HartMask, _: usize, _: usize, _: usize) -> SbiRet {
  24. todo!()
  25. }
  26. fn remote_hfence_vvma(&self, _: HartMask, _: usize, _: usize) -> SbiRet {
  27. todo!()
  28. }
  29. }
  30. pub struct MyEnvInfo;
  31. impl EnvInfo for MyEnvInfo {
  32. fn mvendorid(&self) -> usize {
  33. 0x100
  34. }
  35. fn marchid(&self) -> usize {
  36. 0x200
  37. }
  38. fn mimpid(&self) -> usize {
  39. 0x300
  40. }
  41. }