public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* fix the setjmp fix
@ 2003-05-14 17:12 David Mosberger
  2003-05-14 20:44 ` Ulrich Drepper
  0 siblings, 1 reply; 2+ messages in thread
From: David Mosberger @ 2003-05-14 17:12 UTC (permalink / raw)
  To: libc-hacker

My previous fix for setjmp() introduced another bug.  Embarrasing, but
true: ar.unat was saved in a scratch register, but I forgot that
setjmp is not a leaf (it calls __sigjmp_save).  The patch below should
help.

Thanks to Gwenole Beauchesne from Mandrake for discovering and
reporting this problem.

	--david

2003-05-13  David Mosberger  <davidm@hpl.hp.com>

	* sysdeps/unix/sysv/linux/ia64/setjmp.S: Fix the fix from
	2003-03-27: setjmp is NOT a leaf-routine (due to the call to
	__sigjmp_save) so we can't keep the saved unat value in a scratch
	register (r16).  Use loc2 instead.

Index: sysdeps/unix/sysv/linux/ia64/setjmp.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/ia64/setjmp.S,v
retrieving revision 1.8
diff -u -r1.8 setjmp.S
--- sysdeps/unix/sysv/linux/ia64/setjmp.S	27 Mar 2003 19:50:25 -0000	1.8
+++ sysdeps/unix/sysv/linux/ia64/setjmp.S	13 May 2003 17:49:28 -0000
@@ -86,9 +86,9 @@
 
 ENTRY(__sigsetjmp)
 	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(2)
-	alloc loc1=ar.pfs,2,2,2,0
-	.save ar.unat, r16
-	mov r16=ar.unat
+	alloc loc1=ar.pfs,2,3,2,0
+	.save ar.unat, loc2
+	mov loc2=ar.unat
 	;;
 	mov r17=ar.fpsr
 	mov r2=in0
@@ -97,7 +97,7 @@
 .mem.offset 8,0;	st8.spill.nta [r2]=sp,16	// r12 (sp)
 .mem.offset 0,0;	st8.spill.nta [r3]=gp,16	// r1 (gp)
 	;;
-	st8.nta [r2]=r16,16		// save caller's unat
+	st8.nta [r2]=loc2,16		// save caller's unat
 	st8.nta [r3]=r17,16		// save fpsr
 	add r8=0xa0,in0
 	;;
@@ -171,7 +171,7 @@
 	st8.nta [r3]=in0		// &__jmp_buf
 	br.call.dpnt.few rp=__sigjmp_save
 .ret0:					// force a new bundle ::q
-	mov.m ar.unat=r16		// restore caller's unat
+	mov.m ar.unat=loc2		// restore caller's unat
 	mov rp=loc0
 	mov ar.pfs=loc1
 	mov r8=0

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: fix the setjmp fix
  2003-05-14 17:12 fix the setjmp fix David Mosberger
@ 2003-05-14 20:44 ` Ulrich Drepper
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2003-05-14 20:44 UTC (permalink / raw)
  To: davidm; +Cc: libc-hacker

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David Mosberger wrote:

> 2003-05-13  David Mosberger  <davidm@hpl.hp.com>
> 
> 	* sysdeps/unix/sysv/linux/ia64/setjmp.S: Fix the fix from
> 	2003-03-27: setjmp is NOT a leaf-routine (due to the call to
> 	__sigjmp_save) so we can't keep the saved unat value in a scratch
> 	register (r16).  Use loc2 instead.

I've applied the patch.  Thanks,

- -- 
- --------------.                        ,-.            444 Castro Street
Ulrich Drepper \    ,-----------------'   \ Mountain View, CA 94041 USA
Red Hat         `--' drepper at redhat.com `---------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+wqp42ijCOnn/RHQRAsvvAJ9OwQFnMTx9xMQAlO156BfLG9EF9ACgn6Lr
eC5tseZDQWOh6hnMdCstIj0=
=urqo
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-05-14 20:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-14 17:12 fix the setjmp fix David Mosberger
2003-05-14 20:44 ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).