在pendsv中断实现的threadx M4端口上,它做threadx多线程支持的实际上下文切换,它显示了所有的过程,中断都像其他rtos一样打开而没有禁用,比如ucos,rtthread等,所以是这样导致运行时无法预测的事情?
像下面的代码一样,“cpsie i”在下一个准备运行的线程恢复之前执行
202行允许中断,但是实际的上下文swithc还没有完成,这不像ucos在m4端口上做的,为什么这样安全?谢谢你!
**202 CPSIE i** @ Enable interrupts
203 @
204 @ /* Increment the thread run count. */
205 @
206 __tx_ts_restore:
207 LDR r7, [r1, #4] @ Pickup the current thread run count
208 LDR r4, =_tx_timer_time_slice @ Build address of time-slice variable
209 LDR r5, [r1, #24] @ Pickup thread's current time-slice
210 ADD r7, r7, #1 @ Increment the thread run count
211 STR r7, [r1, #4] @ Store the new run count
212 @
213 @ /* Setup global time-slice with thread's current time-slice. */
214 @
215 STR r5, [r4] @ Setup global time-slice
216
217 #ifdef TX_ENABLE_EXECUTION_CHANGE_NOTIFY
218 @
219 @ /* Call the thread entry function to indicate the thread is executing. */
220 @
221 PUSH {r0, r1} @ Save r0/r1
222 BL _tx_execution_thread_enter @ Call the thread execution enter function
223 POP {r0, r1} @ Recover r3
224 #endif
225 @
226 @ /* Restore the thread context and PSP. */
227 @
228 LDR r12, [r1, #8] @ Pickup thread's stack pointer
229 LDMIA r12!, {LR} @ Pickup LR
230 #ifdef TX_ENABLE_FPU_SUPPORT
231 TST LR, #0x10 @ Determine if the VFP extended frame is present
232 BNE _skip_vfp_restore @ If not, skip VFP restore
233 VLDMIA r12!, {s16-s31} @ Yes, restore additional VFP registers
234 _skip_vfp_restore:
235 #endif
236 LDMIA r12!, {r4-r11} @ Recover thread's registers
237 MSR PSP, r12 @ Setup the thread's stack pointer
238 @
239 @ /* Return to thread. */
240 @
241 BX lr @ Return to thread!