Przeglądaj źródła

impl sfence_vma & sfence_vma_all

WangRunji 6 lat temu
rodzic
commit
9dc7b40fdd
1 zmienionych plików z 12 dodań i 0 usunięć
  1. 12 0
      src/asm.rs

+ 12 - 0
src/asm.rs

@@ -22,3 +22,15 @@ instruction!(uret, "uret");
 instruction!(sret, "sret");
 instruction!(mret, "mret");
 instruction!(wfi, "wfi");
+instruction!(sfence_vma_all, "sfence.vma");
+
+
+#[inline]
+#[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))]
+pub unsafe fn sfence_vma(asid: usize, addr: usize) {
+    asm!("sfence.vma $0, $1" :: "r"(asid), "r"(addr) :: "volatile");
+}
+
+#[inline]
+#[cfg(not(any(target_arch = "riscv32", target_arch = "riscv64")))]
+pub fn sfence_vma(_asid: usize, _addr: usize) {}