diff --git a/arch/arm64/core/switch.S b/arch/arm64/core/switch.S index 333b8f0b21e..06a95d37b7a 100644 --- a/arch/arm64/core/switch.S +++ b/arch/arm64/core/switch.S @@ -74,6 +74,13 @@ SECTION_FUNC(TEXT, z_arm64_context_switch) ldp x0, x1, [sp], #16 #endif +#ifdef CONFIG_SMP + /* Write barrier: ensure all preceding writes are executed + * before writing the switch handle + */ + dmb sy +#endif + /* save old thread into switch handle which is required by * z_sched_switch_spin() */