From afc7a9c4e9ac838bf3e2e6148402d11d3756ce95 Mon Sep 17 00:00:00 2001 From: Yifan Wu Date: Sun, 3 Jan 2021 17:42:58 +0800 Subject: [PATCH] Flush icache before returning to user. --- os/src/trap/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/os/src/trap/mod.rs b/os/src/trap/mod.rs index 8eb34445..4f5126b2 100644 --- a/os/src/trap/mod.rs +++ b/os/src/trap/mod.rs @@ -102,6 +102,7 @@ pub fn trap_return() -> ! { } let restore_va = __restore as usize - __alltraps as usize + TRAMPOLINE; unsafe { + llvm_asm!("fence.i" :::: "volatile"); llvm_asm!("jr $0" :: "r"(restore_va), "{a0}"(trap_cx_ptr), "{a1}"(user_satp) :: "volatile"); } panic!("Unreachable in back_to_user!");