summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2016-12-17 19:30:03 -0500
committerRich Felker <dalias@aerifal.cx>2016-12-17 19:30:03 -0500
commitfbbeda172d6f146067f9f57ab1498cf99c8d1007 (patch)
tree18b0422aa8e781c12c536b9fcd934daf0d2b22ef
parent61ff1af76f4887bb7c555e4d0b8a7eeb73b05086 (diff)
downloadmusl-fbbeda172d6f146067f9f57ab1498cf99c8d1007.tar.gz
make arm setjmp/longjmp asm thumb2-compatible
sp cannot be used in the ldm/stm register set in thumb mode.
-rw-r--r--src/setjmp/arm/longjmp.s4
-rw-r--r--src/setjmp/arm/setjmp.s4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/setjmp/arm/longjmp.s b/src/setjmp/arm/longjmp.s
index e28d8f31..6191ab26 100644
--- a/src/setjmp/arm/longjmp.s
+++ b/src/setjmp/arm/longjmp.s
@@ -8,7 +8,9 @@ longjmp:
mov ip,r0
movs r0,r1
moveq r0,#1
- ldmia ip!, {v1,v2,v3,v4,v5,v6,sl,fp,sp,lr}
+ ldmia ip!, {v1,v2,v3,v4,v5,v6,sl,fp}
+ ldmia ip!, {r2,lr}
+ mov sp,r2
adr r1,1f
ldr r2,1f
diff --git a/src/setjmp/arm/setjmp.s b/src/setjmp/arm/setjmp.s
index 87791634..c6fe1bb2 100644
--- a/src/setjmp/arm/setjmp.s
+++ b/src/setjmp/arm/setjmp.s
@@ -9,7 +9,9 @@ __setjmp:
_setjmp:
setjmp:
mov ip,r0
- stmia ip!,{v1,v2,v3,v4,v5,v6,sl,fp,sp,lr}
+ stmia ip!,{v1,v2,v3,v4,v5,v6,sl,fp}
+ mov r2,sp
+ stmia ip!,{r2,lr}
mov r0,#0
adr r1,1f