about summary refs log tree commit diff
path: root/src/setjmp
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2016-01-25 13:20:52 +0100
committerRich Felker <dalias@aerifal.cx>2016-03-06 17:03:01 -0500
commit5a92dd95c77cee81755f1a441ae0b71e3ae2bcdb (patch)
treea7a12a71e2a505ed4a5c20c1356fc2d7cf2cb2f1 /src/setjmp
parent9543656cc32fda48fc463f332ee20e91eed2b768 (diff)
downloadmusl-5a92dd95c77cee81755f1a441ae0b71e3ae2bcdb.tar.gz
musl-5a92dd95c77cee81755f1a441ae0b71e3ae2bcdb.tar.xz
musl-5a92dd95c77cee81755f1a441ae0b71e3ae2bcdb.zip
add powerpc soft-float support
Some PowerPC CPUs (e.g. Freescale MPC85xx) have a completely different
instruction set for floating point operations (SPE).
Executing regular PowerPC floating point instructions results in
"Illegal instruction" errors.

Make it possible to run these devices in soft-float mode.
Diffstat (limited to 'src/setjmp')
-rw-r--r--src/setjmp/powerpc/longjmp.S (renamed from src/setjmp/powerpc/longjmp.s)24
-rw-r--r--src/setjmp/powerpc/setjmp.S (renamed from src/setjmp/powerpc/setjmp.s)14
2 files changed, 22 insertions, 16 deletions
diff --git a/src/setjmp/powerpc/longjmp.s b/src/setjmp/powerpc/longjmp.S
index bab17511..e598bd05 100644
--- a/src/setjmp/powerpc/longjmp.s
+++ b/src/setjmp/powerpc/longjmp.S
@@ -4,19 +4,21 @@
 	.type   longjmp,@function
 _longjmp:
 longjmp:
-# void longjmp(jmp_buf env, int val);
-# put val into return register and restore the env saved in setjmp
-# if val(r4) is 0, put 1 there.
-	# 0) move old return address into r0
+	/*
+	 * void longjmp(jmp_buf env, int val);
+	 * put val into return register and restore the env saved in setjmp
+	 * if val(r4) is 0, put 1 there.
+	 */
+	/* 0) move old return address into r0 */
 	lwz 0, 0(3)
-	# 1) put it into link reg
+	/* 1) put it into link reg */
 	mtlr 0
-	#2 ) restore stack ptr
+	/* 2 ) restore stack ptr */
 	lwz 1, 4(3)
-	#3) restore control reg
+	/* 3) restore control reg */
 	lwz 0, 8(3)
 	mtcr 0
-	#4) restore r14-r31
+	/* 4) restore r14-r31 */
 	lwz 14, 12(3)
 	lwz 15, 16(3)
 	lwz 16, 20(3)
@@ -35,6 +37,7 @@ longjmp:
 	lwz 29, 72(3)
 	lwz 30, 76(3)
 	lwz 31, 80(3)
+#ifndef _SOFT_FLOAT
 	lfd 14,88(3)
 	lfd 15,96(3)
 	lfd 16,104(3)
@@ -53,10 +56,11 @@ longjmp:
 	lfd 29,208(3)
 	lfd 30,216(3)
 	lfd 31,224(3)
-	#5) put val into return reg r3
+#endif
+	/* 5) put val into return reg r3 */
 	mr 3, 4
 
-	#6) check if return value is 0, make it 1 in that case
+	/* 6) check if return value is 0, make it 1 in that case */
 	cmpwi cr7, 4, 0
 	bne cr7, 1f
 	li 3, 1
diff --git a/src/setjmp/powerpc/setjmp.s b/src/setjmp/powerpc/setjmp.S
index 122177f1..cd91a207 100644
--- a/src/setjmp/powerpc/setjmp.s
+++ b/src/setjmp/powerpc/setjmp.S
@@ -10,15 +10,15 @@ ___setjmp:
 __setjmp:
 _setjmp:
 setjmp:
-	# 0) store IP int 0, then into the jmpbuf pointed to by r3 (first arg)
+	/* 0) store IP int 0, then into the jmpbuf pointed to by r3 (first arg) */
 	mflr 0
 	stw 0, 0(3)
-	# 1) store reg1 (SP)
+	/* 1) store reg1 (SP) */
 	stw 1, 4(3)
-	# 2) store cr
+	/* 2) store cr */
 	mfcr 0
 	stw 0, 8(3)
-	# 3) store r14-31
+	/* 3) store r14-31 */
 	stw 14, 12(3)
 	stw 15, 16(3)
 	stw 16, 20(3)
@@ -37,6 +37,7 @@ setjmp:
 	stw 29, 72(3)
 	stw 30, 76(3)
 	stw 31, 80(3)
+#ifndef _SOFT_FLOAT
 	stfd 14,88(3)
 	stfd 15,96(3)
 	stfd 16,104(3)
@@ -55,7 +56,8 @@ setjmp:
 	stfd 29,208(3)
 	stfd 30,216(3)
 	stfd 31,224(3)
-	# 4) set return value to 0
+#endif
+	/* 4) set return value to 0 */
 	li 3, 0
-	# 5) return
+	/* 5) return */
 	blr