xous: add cache_flush() call

This call is designed to flush the CPU caches by calling the `FENCE`
instruction.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2021-07-18 10:31:10 +08:00
parent c662ca7fdd
commit 6f77ab8344
7 changed files with 13 additions and 0 deletions

View file

@ -379,3 +379,11 @@ pub fn wait_process(_joiner: ProcessHandle) -> crate::SysCallResult {
crate::wait_event();
}
}
extern "C" {
fn riscv_cache_flush();
}
pub fn cache_flush() {
unsafe { riscv_cache_flush() };
}

View file

@ -98,3 +98,8 @@ vex_aes_dec_id_last_2:
vex_aes_dec_id_last_3:
.word 0x36b5050b // vex_aes_dec_id_last a0, a1, a0, #3
ret
.global riscv_cache_flush
riscv_cache_flush:
fence
ret