[klibc] [PATCH 4/5] mips: don't save floating point registers in setjmp / longjmp

James Cowgill james.cowgill at mips.com
Fri Mar 2 08:33:03 PST 2018


Don't bother saving any floating point registers in setjmp or restoring
them in longjmp. This causes issues when compiling for the FPXX ABI, and
is unnessesary as klibc does not support floating point code.
Additionally, remove the unused parts of __jmp_buf.

Signed-off-by: James Cowgill <james.cowgill at mips.com>

---

This patch is similar to a prvious patch written by Yunqiang Su, however
I also added some extra cleanups. We don't need to save the floating
point control register (fcr31) and we can remove the extra space
allocated in __jmp_buf. Also remove __unused which I assume was only
there for alignment purposes.
---
 usr/include/arch/mips/klibc/archsetjmp.h | 14 --------------
 usr/klibc/arch/mips/setjmp.S             | 30 ------------------------------
 2 files changed, 44 deletions(-)

diff --git a/usr/include/arch/mips/klibc/archsetjmp.h b/usr/include/arch/mips/klibc/archsetjmp.h
index 1fbe83ef..eeadffce 100644
--- a/usr/include/arch/mips/klibc/archsetjmp.h
+++ b/usr/include/arch/mips/klibc/archsetjmp.h
@@ -18,20 +18,6 @@ struct __jmp_buf {
 	unsigned long __sp;
 	unsigned long __s8;
 	unsigned long __ra;
-	unsigned long __f20;
-	unsigned long __f21;
-	unsigned long __f22;
-	unsigned long __f23;
-	unsigned long __f24;
-	unsigned long __f25;
-	unsigned long __f26;
-	unsigned long __f27;
-	unsigned long __f28;
-	unsigned long __f29;
-	unsigned long __f30;
-	unsigned long __f31;
-	unsigned long __fcr31;
-	unsigned long __unused;
 } __attribute__ ((aligned(8)));
 
 typedef struct __jmp_buf jmp_buf[1];
diff --git a/usr/klibc/arch/mips/setjmp.S b/usr/klibc/arch/mips/setjmp.S
index 68eed19d..9145dbc0 100644
--- a/usr/klibc/arch/mips/setjmp.S
+++ b/usr/klibc/arch/mips/setjmp.S
@@ -9,8 +9,6 @@
 #	sp
 #	s8
 #	ra
-#	f20..f31
-#	fcr31
 #
 
 #include <machine/asm.h>
@@ -28,20 +26,6 @@ LEAF(setjmp)
 	sw	sp, 36(a0)
 	sw	s8, 40(a0)
 	sw	ra, 44(a0)
-	cfc1	t0,$31
-	swc1	$f20,48(a0)
-	swc1	$f21,52(a0)
-	swc1	$f22,56(a0)
-	swc1	$f23,60(a0)
-	swc1	$f24,64(a0)
-	swc1	$f25,68(a0)
-	swc1	$f26,72(a0)
-	swc1	$f27,76(a0)
-	swc1	$f28,80(a0)
-	swc1	$f29,84(a0)
-	swc1	$f30,88(a0)
-	swc1	$f31,92(a0)
-	sw	t0,96(a0)
 	move	v0,zero
 	jr	ra
 
@@ -60,20 +44,6 @@ LEAF(longjmp)
 	lw	sp, 36(a0)
 	lw	s8, 40(a0)
 	lw	ra, 44(a0)
-	lw	t0, 96(a0)
-	lwc1	$f20,48(a0)
-	lwc1	$f21,52(a0)
-	lwc1	$f22,56(a0)
-	lwc1	$f23,60(a0)
-	lwc1	$f24,64(a0)
-	lwc1	$f25,68(a0)
-	lwc1	$f26,72(a0)
-	lwc1	$f27,76(a0)
-	lwc1	$f28,80(a0)
-	lwc1	$f29,84(a0)
-	lwc1	$f30,88(a0)
-	lwc1	$f31,92(a0)
-	ctc1	t0,$31
 	move	v0,a1
 	jr	ra
 
-- 
2.16.2



More information about the klibc mailing list