- __asm volatile (\r
- " ldr r3, pxCurrentTCBConst2 \n" /* Restore the context. */\r
- " ldr r1, [r3] \n" /* Use pxCurrentTCBConst to get the pxCurrentTCB address. */\r
- " ldr r0, [r1] \n" /* The first item in pxCurrentTCB is the task top of stack. */\r
- " add r0, r0, #16 \n" /* Move to the high registers. */\r
- " ldmia r0!, {r4-r7} \n" /* Pop the high registers. */\r
- " mov r8, r4 \n"\r
- " mov r9, r5 \n"\r
- " mov r10, r6 \n"\r
- " mov r11, r7 \n"\r
- " \n"\r
- " msr psp, r0 \n" /* Remember the new top of stack for the task. */\r
- " \n"\r
- " sub r0, r0, #32 \n" /* Go back for the low registers that are not automatically restored. */\r
- " ldmia r0!, {r4-r7} \n" /* Pop low registers. */\r
- " mov r1, r14 \n" /* OR R14 with 0x0d. */\r
- " movs r0, #0x0d \n"\r
- " orr r1, r0 \n"\r
- " bx r1 \n"\r
- " \n"\r
- " .align 2 \n"\r
- "pxCurrentTCBConst2: .word pxCurrentTCB \n"\r
- );\r