提交 04234d18 编写于 作者: B bernard.xiong

fix context switch bug because interrupt preemptive occurs during context switch procedure.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@48 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 90238948
......@@ -81,6 +81,11 @@ rt_hw_context_switch PROC
; psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack
rt_hw_pend_sv PROC
EXPORT rt_hw_pend_sv
; disable interrupt to protect context switch
MRS r2, PRIMASK
CPSID I
; clear rt_thread_switch_interrput_flag to 0
LDR r0, =rt_thread_switch_interrput_flag
MOV r1, #0x00
......@@ -103,6 +108,9 @@ swtich_to_thread
LDMFD r1!, {r4 - r11} ; pop r4 - r11 register
MSR psp, r1 ; update stack pointer
; restore interrupt
MSR PRIMASK, r2
ORR lr, lr, #0x04
BX lr
ENDP
......@@ -183,7 +191,6 @@ rt_hw_interrupt_thread_switch PROC
_no_switch
BX lr
NOP
ENDP
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册