From 6677cfbf1e0454d06e61c8c67b4d3019cf94f18a Mon Sep 17 00:00:00 2001 From: Robin Randhawa Date: Fri, 15 Jan 2021 19:02:43 +0000 Subject: [PATCH 1/2] aarch64: Make interrupt::pause use nop so we can move ahead before interrupts are enabled --- src/arch/aarch64/interrupt/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arch/aarch64/interrupt/mod.rs b/src/arch/aarch64/interrupt/mod.rs index b7451af..9811df2 100644 --- a/src/arch/aarch64/interrupt/mod.rs +++ b/src/arch/aarch64/interrupt/mod.rs @@ -49,7 +49,7 @@ pub unsafe fn halt() { /// Safe because it is similar to a NOP, and has no memory effects #[inline(always)] pub fn pause() { - unsafe { llvm_asm!("wfi") }; + unsafe { llvm_asm!("nop") }; } pub fn available_irqs_iter(cpu_id: usize) -> impl Iterator + 'static { From 5bc9dea242d68fa9942ef29a0e8511ad65c5f6a6 Mon Sep 17 00:00:00 2001 From: Robin Randhawa Date: Fri, 15 Jan 2021 19:03:42 +0000 Subject: [PATCH 2/2] aarch64: context::switch: update the CONTEXT_SWITCH_LOCK --- src/context/arch/aarch64.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/context/arch/aarch64.rs b/src/context/arch/aarch64.rs index 5f5e2a3..ac74e22 100644 --- a/src/context/arch/aarch64.rs +++ b/src/context/arch/aarch64.rs @@ -239,6 +239,8 @@ impl Context { llvm_asm!("mov $0, sp" : "=r"(self.sp) : : "memory" : "volatile"); llvm_asm!("mov sp, $0" : : "r"(next.sp) : "memory" : "volatile"); + + CONTEXT_SWITCH_LOCK.store(false, Ordering::SeqCst); } }