From 3dc08c878f34fa43d091e44cc69c0bfc9ff4ff14 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Tue, 4 May 2021 08:07:44 -0600 Subject: [PATCH] Fix aarch64 switch_to function --- src/context/arch/aarch64.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/context/arch/aarch64.rs b/src/context/arch/aarch64.rs index 39f45c0..274200c 100644 --- a/src/context/arch/aarch64.rs +++ b/src/context/arch/aarch64.rs @@ -225,7 +225,7 @@ impl Context { #[cold] #[inline(never)] #[naked] -pub unsafe fn switch_to(prev: &mut Context, next: &mut Context) { +pub unsafe extern "C" fn switch_to(prev: &mut Context, next: &mut Context) { let mut float_regs = &mut *(prev.fx_address as *mut FloatRegisters); asm!( "stp q0, q1, [{0}, #16 * 0]", @@ -376,7 +376,8 @@ pub unsafe fn switch_to(prev: &mut Context, next: &mut Context) { llvm_asm!("mov $0, sp" : "=r"(prev.sp) : : "memory" : "volatile"); llvm_asm!("mov sp, $0" : : "r"(next.sp) : "memory" : "volatile"); - CONTEXT_SWITCH_LOCK.store(false, Ordering::SeqCst); + // Jump to switch hook + asm!("b {switch_hook}", switch_hook = sym crate::context::switch_finish_hook); } #[allow(dead_code)]