diff --git a/arch/arm/swapcontext.S b/arch/arm/swapcontext.S index f841182..f0627bf 100644 --- a/arch/arm/swapcontext.S +++ b/arch/arm/swapcontext.S @@ -16,12 +16,6 @@ ALIAS(swapcontext, libucontext_swapcontext) ALIAS(__swapcontext, libucontext_swapcontext) FUNC(libucontext_swapcontext) - /* copy all of the current registers into the ucontext structure */ - add r2, r0, #REG_OFFSET(0) - stmia r2, {r0-r12} - str r13, [r0,#REG_OFFSET(13)] - str r14, [r0,#REG_OFFSET(15)] - #ifndef FORCE_SOFT_FLOAT #ifndef FORCE_HARD_FLOAT /* test for vfp magic number, copy to other ucontext */ @@ -42,6 +36,14 @@ FUNC(libucontext_swapcontext) 1: #endif + /* copy all of the current registers into the ucontext structure */ + str r13, [r0,#REG_OFFSET(13)] + str r14, [r0,#REG_OFFSET(15)] + add r2, r0, #REG_OFFSET(0) + /* copy r0 with value 0 to indicate success (return value 0) */ + mov r0, #0 + stmia r2, {r0-r12} + /* load new registers from the second ucontext structure */ add r14, r1, #REG_OFFSET(0) ldmia r14, {r0-r12}