arch: arm: introduce barriers when disabling interrupts
The ARM Cortex-M 321 application note is stressing that if we disable interrupts by executing CPSID i(f), or by MSR instructions (on PRIMASK, FAULTMASK registers), there is no requirement to add barrier instructions after disabling interupts. However, in ARMv7-M (and ARMv8-M Mainline) we use BASEPRI, instead. Therefore, if we need the effect of disabling interrupts to be recongnized immediately we should add barrier instructions. This commit adds DSB and ISB barriers when disabling interrupt using BASEPRI in the generic arm _irq_lock() function as well as in the PendSV handler, where we need to access kernel globals right after the interrups are disabled. Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit is contained in:
parent
69613cad6a
commit
a0851c47aa
2 changed files with 3 additions and 1 deletions
|
@ -132,7 +132,8 @@ static ALWAYS_INLINE unsigned int z_arch_irq_lock(void)
|
|||
__asm__ volatile(
|
||||
"mov %1, %2;"
|
||||
"mrs %0, BASEPRI;"
|
||||
"msr BASEPRI, %1"
|
||||
"msr BASEPRI, %1;"
|
||||
"isb;"
|
||||
: "=r"(key), "=r"(tmp)
|
||||
: "i"(_EXC_IRQ_DEFAULT_PRIO)
|
||||
: "memory");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue