Skip to content

Commit d97299c

Browse files
mshawcroftgalak
authored andcommitted
arm: fix irq_unlock() ordering bug
Add the missing memory clobber to irq_unlock() in order to prevent the compiler reordering memory operations over the unlock. Change-Id: If1d664079796618ed247ff5b33b8b3f85fb7e680 Signed-off-by: Marcus Shawcroft <[email protected]>
1 parent 6e2fbea commit d97299c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/arch/arm/cortex_m/asm_inline_gcc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ static ALWAYS_INLINE void _arch_irq_unlock(unsigned int key)
173173
if (key) {
174174
return;
175175
}
176-
__asm__ volatile("cpsie i;\n\t");
176+
__asm__ volatile("cpsie i;\n\t" : : : "memory");
177177
#else /* CONFIG_CPU_CORTEX_M3_M4 */
178-
__asm__ volatile("msr BASEPRI, %0;\n\t" : : "r"(key));
178+
__asm__ volatile("msr BASEPRI, %0;\n\t" : : "r"(key) : "memory");
179179
#endif
180180
}
181181

0 commit comments

Comments
 (0)