impl sfence_vma & sfence_vma_all

This commit is contained in:
WangRunji 2018-11-09 22:27:19 +08:00
parent 4e16dd85ed
commit 9dc7b40fdd
1 changed files with 12 additions and 0 deletions

View File

@ -22,3 +22,15 @@ instruction!(uret, "uret");
instruction!(sret, "sret"); instruction!(sret, "sret");
instruction!(mret, "mret"); instruction!(mret, "mret");
instruction!(wfi, "wfi"); 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) {}