This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

v850 setjmp/longjmp patch


The v850 setjmp routine does not correctly set the return value and
the v850 longjmp routine does not use the second argument passed
in as described by the longjmp manpage. The following changes
have been made to the code to correct these problems:

2000-09-08  Will Cohen  <wcohen@redhat.com>

	* libc/machine/v850/setjmp.S (_setjmp): Save r1 rather than r0.
	Added return value 0.
	(_longjmp): Allow longjmp to return value of second argument
	passed to it.

-Will Cohen
Index: ./newlib/libc/machine/v850/setjmp.S
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libc/machine/v850/setjmp.S,v
retrieving revision 1.1
diff -c -2 -p -r1.1 setjmp.S
*** setjmp.S	1996/08/22 22:57:25	1.1
--- setjmp.S	2000/09/08 13:59:01
***************
*** 5,9 ****
  	.global _setjmp
  _setjmp:
! 	st.w r0,0[r6]
  	st.w r3,4[r6]
  	st.w r4,8[r6]
--- 5,9 ----
  	.global _setjmp
  _setjmp:
! 	st.w r1,0[r6]
  	st.w r3,4[r6]
  	st.w r4,8[r6]
*************** _setjmp:
*** 20,28 ****
  	st.w r30,52[r6]
  	st.w r31,56[r6]
  	jmp [r31]
  
  	.global _longjmp
  _longjmp:
! 	ld.w 0[r6],r0
  	ld.w 4[r6],r3
  	ld.w 8[r6],r4
--- 20,29 ----
  	st.w r30,52[r6]
  	st.w r31,56[r6]
+ 	mov r0, r10
  	jmp [r31]
  
  	.global _longjmp
  _longjmp:
! 	ld.w 0[r6],r1
  	ld.w 4[r6],r3
  	ld.w 8[r6],r4
*************** _longjmp:
*** 39,42 ****
  	ld.w 52[r6],r30
  	ld.w 56[r6],r31
! 	mov 1,r10
  	jmp [r31]
--- 40,47 ----
  	ld.w 52[r6],r30
  	ld.w 56[r6],r31
! 	cmp r7, r0
! 	jne 1f
! 	mov 1,r7
! 1:
! 	mov r7, r10
  	jmp [r31]

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