summaryrefslogtreecommitdiff
path: root/libcpu/arm/cortex-a
diff options
context:
space:
mode:
authorShell <[email protected]>2023-07-25 14:07:44 +0800
committerGitHub <[email protected]>2023-07-25 14:07:44 +0800
commitacfa74f078b23d670ad04c3a2aa9cec5fbcf5afe (patch)
tree590ae17b763a050d32bd326da2dc6ce7155bcde0 /libcpu/arm/cortex-a
parent0a6aaf12ad6801d6bd5caca82edcaca9977f5ff6 (diff)
[libcpu/arm] fix race condition with ldrex,strex (#7842)
Signed-off-by: Shell <[email protected]>
Diffstat (limited to 'libcpu/arm/cortex-a')
-rw-r--r--libcpu/arm/cortex-a/context_gcc.S3
-rw-r--r--libcpu/arm/cortex-a/start_gcc.S2
2 files changed, 3 insertions, 2 deletions
diff --git a/libcpu/arm/cortex-a/context_gcc.S b/libcpu/arm/cortex-a/context_gcc.S
index 98080de5c1..da6e6507df 100644
--- a/libcpu/arm/cortex-a/context_gcc.S
+++ b/libcpu/arm/cortex-a/context_gcc.S
@@ -40,6 +40,7 @@ rt_hw_interrupt_enable:
*/
.globl rt_hw_context_switch_to
rt_hw_context_switch_to:
+ clrex
ldr sp, [r0] @ get new task stack pointer
#ifdef RT_USING_SMP
@@ -76,6 +77,7 @@ _guest_switch_lvl:
*/
.globl rt_hw_context_switch
rt_hw_context_switch:
+ clrex
stmfd sp!, {lr} @ push pc (lr should be pushed in place of PC)
stmfd sp!, {r0-r12, lr} @ push lr & register file
@@ -143,6 +145,7 @@ rt_hw_context_switch:
.globl rt_interrupt_to_thread
.globl rt_hw_context_switch_interrupt
rt_hw_context_switch_interrupt:
+ clrex
#ifdef RT_USING_SMP
/* r0 :svc_mod context
* r1 :addr of from_thread's sp
diff --git a/libcpu/arm/cortex-a/start_gcc.S b/libcpu/arm/cortex-a/start_gcc.S
index 6ff40b1b31..606620ecfc 100644
--- a/libcpu/arm/cortex-a/start_gcc.S
+++ b/libcpu/arm/cortex-a/start_gcc.S
@@ -408,8 +408,6 @@ vector_fiq:
.globl vector_irq
vector_irq:
#ifdef RT_USING_SMP
- clrex
-
stmfd sp!, {r0, r1}
cps #Mode_SVC
mov r0, sp /* svc_sp */