Skip to content
Commit 6e2fbead authored by Marcus Shawcroft's avatar Marcus Shawcroft Committed by Kumar Gala
Browse files

kernel: Fix ARM irq_lock() ordering bug.



The inline asm definition of irq_lock() on the ARM architecture marks
the ASM as volatile which prevents the compiler from removing the
isntruction but does provide any information to the compiler to
prevent the inline ASM instruction being re-ordered relative to other
instructions.  The instruction used in irq_lock() do not touch memory,
however in order to acheive their intended purpose they must be
ordered relative to other memory access instruction.  This is acheived
by adding the "memory" clobber.

Instances of the compiler inappropriately re-ordering irq_lock() calls
relative to other instructions without this patch can be observed in
the code generated for k_sleep() on NRF51 target boards.

Signed-off-by: default avatarMarcus Shawcroft <marcus.shawcroft@arm.com>
Change-Id: I9d42d54cd9a50e8150c10ce6715af7ca2f5cfe51
(cherry picked from commit 15bc5377)
parent 9adaf59d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment