- ldr r0, [r1] \r
- ldmia r0!, {r1, r4-r11} \r
- ldr r2, =uxCriticalNesting\r
- str r1, [r2] \r
+ stmdb r0!, {r1,r4-r11} \r
+ str r0, [r2] /* Save the new top of stack into the first member of the TCB. */\r
+\r
+ stmdb sp!, {r3, r14} \r
+ bl vTaskSwitchContext \r
+ ldmia sp!, {r3, r14} \r
+\r
+ ldr r1, [r3] \r
+ ldr r2, =uxCriticalNesting \r
+ ldr r0, [r1] /* The first item in pxCurrentTCB is the task top of stack. */\r
+ ldmia r0!, {r1, r4-r11} /* Pop the registers and the critical nesting count. */\r
+ str r1, [r2] /* Save the new critical nesting value into ulCriticalNesting. */\r