This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch to add MIPS64 version of setjmp() & longjmp()



This patch adds a MIPS64 version of setjmp() & longjmp().  Please
install if OK.

Richard

2001-03-07  Richard Sandiford  <rsandifo@redhat.com>

	* (libc/include/machine/setjmp.h): Use 23 DI-mode ints for a
	jmpbuf on MIPS64 targets.
	* (libc/machine/mips/setjmp.S): Add MIPS64 version.

Index: ./newlib/libc/include/machine/setjmp.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/machine/setjmp.h,v
retrieving revision 1.2
diff -c -p -d -r1.2 setjmp.h
*** ./newlib/libc/include/machine/setjmp.h	2000/05/30 17:18:05	1.2
--- ./newlib/libc/include/machine/setjmp.h	2001/03/07 13:56:17
***************
*** 59,65 ****
--- 59,71 ----
  #endif

  #ifdef __mips__
+ #ifdef __mips64
+ #define _JBLEN 23
+ typedef int __jmpbuf_elt  __attribute__((mode(DI)));
+ #define _JBTYPE __jmpbuf_elt
+ #else
  #define _JBLEN 11
+ #endif
  #endif

  #ifdef __m88000__
Index: ./newlib/libc/machine/mips/setjmp.S
===================================================================
RCS file: /cvs/src/src/newlib/libc/machine/mips/setjmp.S,v
retrieving revision 1.1.1.1
diff -c -p -d -r1.1.1.1 setjmp.S
*** ./newlib/libc/machine/mips/setjmp.S	2000/02/17 19:39:47	1.1.1.1
--- ./newlib/libc/machine/mips/setjmp.S	2001/03/07 13:56:17
***************
*** 1,11 ****
! /* This is a simple version of setjmp and longjmp.

!    This 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.  */

  #ifdef __mips16
  /* This file contains 32 bit assembly code.  */
  	.set nomips16
--- 1,97 ----
! /* This is a simple version of setjmp and longjmp for MIPS 32 and 64.

!    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.
!
!    The MIPS 64 version saves registers fp20 to fp31.  23 registers
!    are saved in all.  */
!
! #ifdef __mips64
!
! /* int setjmp (jmp_buf);  */
! 	.globl	setjmp
! 	.ent	setjmp
! setjmp:
! 	.frame	$sp,0,$31
!
! 	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 */
!
! 	move	$2,$0
!
! 	j	$31

+ 	.end	setjmp
+
+ /* volatile void longjmp (jmp_buf, int);  */
+ 	.globl	longjmp
+ 	.ent	longjmp
+ longjmp:
+ 	.frame	$sp,0,$31
+
+ 	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 */
+ 	sd	$30, 0250($4)	/* fp */
+ 	ld	$31, 0260($4)	/* ra */
+
+ 	bne	$5,$0,1f
+ 	li	$5,1
+ 1:
+ 	move	$2,$5
+
+ 	j	$31
+
+ 	.end longjmp
+
+ #else /* not __mips64 */
+
  #ifdef __mips16
  /* This file contains 32 bit assembly code.  */
  	.set nomips16
*************** longjmp:
*** 63,65 ****
--- 149,153 ----
  	j	$31

  	.end longjmp
+
+ #endif /* not mips64 */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]