mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/cortexm_common: fix r12 clobber in pendsv for Cortex-M3+
This commit is contained in:
parent
8b8a3ffbd9
commit
04ca147f59
@ -317,20 +317,21 @@ void __attribute__((naked)) __attribute__((used)) isr_pendsv(void) {
|
||||
|
||||
/* skip context saving if sched_active_thread == NULL */
|
||||
"ldr r1, =sched_active_thread \n" /* r1 = &sched_active_thread */
|
||||
"ldr r12, [r1] \n" /* r12 = sched_active_thread */
|
||||
"push {lr} \n" /* push exception return code */
|
||||
"push {r4, lr} \n" /* push r4 and exception return code */
|
||||
"ldr r4, [r1] \n" /* r4 = sched_active_thread */
|
||||
|
||||
"cpsid i \n" /* Disable IRQs during sched_run */
|
||||
"bl sched_run \n" /* perform scheduling */
|
||||
"cpsie i \n" /* Re-enable interrupts */
|
||||
|
||||
"cmp r0, r12 \n" /* if r0 == 0: (no switch required) */
|
||||
"cmp r0, r4 \n" /* if r0 == r1: (new thread == old
|
||||
thread, no switch required) */
|
||||
"it eq \n"
|
||||
"popeq {pc} \n" /* Pop exception to pc to return */
|
||||
"popeq {r4, pc} \n" /* Pop exception to pc to return */
|
||||
|
||||
"pop {lr} \n" /* Pop exception from the exception stack */
|
||||
"mov r1, r4 \n" /* save sched_active_thread in r1 */
|
||||
"pop {r4, lr} \n" /* Pop exception from the exception stack */
|
||||
|
||||
"mov r1,r12 \n" /* r1 = sched_active_thread */
|
||||
"cbz r1, restore_context \n" /* goto restore_context if r1 == 0 */
|
||||
|
||||
"mrs r2, psp \n" /* get stack pointer from user mode */
|
||||
|
Loading…
Reference in New Issue
Block a user