diff options
-rw-r--r-- | newlib/ChangeLog | 9 | ||||
-rw-r--r-- | newlib/libc/include/machine/setjmp.h | 5 | ||||
-rw-r--r-- | newlib/libc/machine/mips/setjmp.S | 75 |
3 files changed, 85 insertions, 4 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 6212f06b0..99ee8f0d3 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,6 +1,13 @@ +2001-03-08 Richard Sandiford <rsandifo@redhat.com> + + * (libc/include/machine/setjmp.h): Use 23 long long ints for a + jmpbuf on MIPS64 targets. + * (libc/machine/mips/setjmp.S): Add MIPS64 version. + Wed Mar 7 16:02:07 2001 Christopher Faylor <cgf@cygnus.com> - * libc/include/sys/config.h: Use ssize_t for read/write declarations. + * libc/include/sys/config.h: Use ssize_t for Cygwin read/write + declarations. Mon Mar 5 21:48:54 2001 J"orn Rennecke <amylaar@redhat.com> diff --git a/newlib/libc/include/machine/setjmp.h b/newlib/libc/include/machine/setjmp.h index 2a54daaa5..747fe17ef 100644 --- a/newlib/libc/include/machine/setjmp.h +++ b/newlib/libc/include/machine/setjmp.h @@ -59,8 +59,13 @@ #endif #ifdef __mips__ +#ifdef __mips64 +#define _JBLEN 23 +#define _JBTYPE long long +#else #define _JBLEN 11 #endif +#endif #ifdef __m88000__ #define _JBLEN 21 diff --git a/newlib/libc/machine/mips/setjmp.S b/newlib/libc/machine/mips/setjmp.S index 8ffda41a6..9532e7a38 100644 --- a/newlib/libc/machine/mips/setjmp.S +++ b/newlib/libc/machine/mips/setjmp.S @@ -1,15 +1,20 @@ -/* This is a simple version of setjmp and longjmp. +/* This is a simple version of setjmp and longjmp for MIPS 32 and 64. - This version does NOT save the floating point register, which is + The MIPS 32 version does NOT save the floating point register, which is wrong, but I don't know how to cleanly handle machines without a floating point coprocessor. - Ian Lance Taylor, Cygnus Support, 13 May 1993. */ + Ian Lance Taylor, Cygnus Support, 13 May 1993. + The MIPS 64 version saves registers fp20 to fp31. 23 registers + are saved in all. */ + +#ifndef __mips64 #ifdef __mips16 /* This file contains 32 bit assembly code. */ .set nomips16 #endif +#endif /* int setjmp (jmp_buf); */ .globl setjmp @@ -17,6 +22,36 @@ setjmp: .frame $sp,0,$31 +#ifdef __mips64 + + sd $16, 000($4) /* s0 */ + sd $17, 010($4) /* s1 */ + sd $18, 020($4) /* s2 */ + sd $19, 030($4) /* s3 */ + sd $20, 040($4) /* s4 */ + sd $21, 050($4) /* s5 */ + sd $22, 060($4) /* s6 */ + sd $23, 070($4) /* s7 */ + + sdc1 $f20, 0100($4) + sdc1 $f21, 0110($4) + sdc1 $f22, 0120($4) + sdc1 $f23, 0130($4) + sdc1 $f24, 0140($4) + sdc1 $f25, 0150($4) + sdc1 $f26, 0160($4) + sdc1 $f27, 0170($4) + sdc1 $f28, 0200($4) + sdc1 $f29, 0210($4) + sdc1 $f30, 0220($4) + sdc1 $f31, 0230($4) + + sd $29, 0240($4) /* sp */ + sd $30, 0250($4) /* fp */ + sd $31, 0260($4) /* ra */ + +#else /* not __mips64 */ + sw $16,0($4) /* $s0 */ sw $17,4($4) /* $s1 */ sw $18,8($4) /* $s2 */ @@ -30,6 +65,8 @@ setjmp: sw $sp,36($4) sw $31,40($4) +#endif /* not __mips64 */ + move $2,$0 j $31 @@ -42,6 +79,36 @@ setjmp: longjmp: .frame $sp,0,$31 +#ifdef __mips64 + + ld $16, 000($4) /* s0 */ + ld $17, 010($4) /* s1 */ + ld $18, 020($4) /* s2 */ + ld $19, 030($4) /* s3 */ + ld $20, 040($4) /* s4 */ + ld $21, 050($4) /* s5 */ + ld $22, 060($4) /* s6 */ + ld $23, 070($4) /* s7 */ + + ldc1 $f20, 0100($4) + ldc1 $f21, 0110($4) + ldc1 $f22, 0120($4) + ldc1 $f23, 0130($4) + ldc1 $f24, 0140($4) + ldc1 $f25, 0150($4) + ldc1 $f26, 0160($4) + ldc1 $f27, 0170($4) + ldc1 $f28, 0200($4) + ldc1 $f29, 0210($4) + ldc1 $f30, 0220($4) + ldc1 $f31, 0230($4) + + ld $29, 0240($4) /* sp */ + ld $30, 0250($4) /* fp */ + ld $31, 0260($4) /* ra */ + +#else /* not __mips64 */ + lw $16,0($4) /* $s0 */ lw $17,4($4) /* $s1 */ lw $18,8($4) /* $s2 */ @@ -55,6 +122,8 @@ longjmp: lw $sp,36($4) lw $31,40($4) +#endif /* not __mips64 */ + bne $5,$0,1f li $5,1 1: |