summaryrefslogtreecommitdiff
path: root/libcpu
diff options
context:
space:
mode:
Diffstat (limited to 'libcpu')
-rw-r--r--libcpu/aarch64/common/context_gcc.S10
-rw-r--r--libcpu/arm/cortex-a/context_gcc.S3
-rw-r--r--libcpu/arm/cortex-a/start_gcc.S2
3 files changed, 9 insertions, 6 deletions
diff --git a/libcpu/aarch64/common/context_gcc.S b/libcpu/aarch64/common/context_gcc.S
index dadd5cffc1..d9dc2d1c93 100644
--- a/libcpu/aarch64/common/context_gcc.S
+++ b/libcpu/aarch64/common/context_gcc.S
@@ -377,7 +377,6 @@ vector_fiq:
.globl vector_irq
vector_irq:
- CLREX
SAVE_CONTEXT
STP X0, X1, [SP, #-0x10]! /* X0 is thread sp */
@@ -391,10 +390,11 @@ vector_irq:
.global rt_hw_context_switch_exit
rt_hw_context_switch_exit:
+ CLREX
MOV X0, SP
RESTORE_CONTEXT
-#else
+#else /* RT_USING_SMP */
/*
* void rt_hw_context_switch_to(rt_ubase_t to);
@@ -402,6 +402,7 @@ rt_hw_context_switch_exit:
*/
.globl rt_hw_context_switch_to
rt_hw_context_switch_to:
+ CLREX
LDR X0, [X0]
RESTORE_CONTEXT
@@ -413,7 +414,7 @@ rt_hw_context_switch_to:
*/
.globl rt_hw_context_switch
rt_hw_context_switch:
-
+ CLREX
SAVE_CONTEXT_FROM_EL1
MOV X2, SP
@@ -430,6 +431,7 @@ rt_hw_context_switch:
.globl rt_interrupt_to_thread
.globl rt_hw_context_switch_interrupt
rt_hw_context_switch_interrupt:
+ CLREX
LDR X6, =rt_thread_switch_interrupt_flag
LDR X7, [X6]
CMP X7, #1
@@ -506,7 +508,7 @@ vector_irq:
vector_irq_exit:
MOV SP, X0
RESTORE_CONTEXT_WITHOUT_MMU_SWITCH
-#endif
+#endif /* RT_USING_SMP */
// -------------------------------------------------
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 */