public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* ia64: unat restoration fixes for setjmp() & getcontext()
@ 2003-03-27 19:51 David Mosberger
  2003-03-27 21:25 ` Ulrich Drepper
  0 siblings, 1 reply; 2+ messages in thread
From: David Mosberger @ 2003-03-27 19:51 UTC (permalink / raw)
  To: libc-hacker

The ia64 versions of __sigsetjmp() and getcontext() failed to restore
ar.unat before returning.  Patch below should fix that.

	--david

2003-03-27  David Mosberger  <davidm@hpl.hp.com>

	* sysdeps/unix/sysv/linux/ia64/getcontext.S: Restore caller's
	ar.unat before returning.  Add missing .mem.offset directives
	to ensure file gets assembled without warnings.

	* sysdeps/unix/sysv/linux/ia64/setjmp.S: Ditto.

Index: sysdeps/unix/sysv/linux/ia64/setjmp.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/ia64/setjmp.S,v
retrieving revision 1.7
diff -u -r1.7 setjmp.S
--- sysdeps/unix/sysv/linux/ia64/setjmp.S	31 Dec 2002 20:37:30 -0000	1.7
+++ sysdeps/unix/sysv/linux/ia64/setjmp.S	27 Mar 2003 18:05:14 -0000
@@ -87,21 +87,22 @@
 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
 	;;
 	mov r17=ar.fpsr
 	mov r2=in0
 	add r3=8,in0
 	;;
-	st8.spill.nta [r2]=sp,16	// r12 (sp)
-	st8.spill.nta [r3]=gp,16	// r1 (gp)
+.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 [r3]=r17,16		// save fpsr
 	add r8=0xa0,in0
 	;;
-	st8.spill.nta [r2]=r4,16	// r4
-	st8.spill.nta [r3]=r5,16	// r5
+.mem.offset 8,0;	st8.spill.nta [r2]=r4,16	// r4
+.mem.offset 0,0;	st8.spill.nta [r3]=r5,16	// r5
 	add r9=0xb0,in0
 	;;
 	stf.spill.nta [r8]=f2,32
@@ -143,8 +144,8 @@
 	stf.spill.nta [r8]=f30
 	stf.spill.nta [r9]=f31
 
-	st8.spill.nta [r2]=r6,16	// r6
-	st8.spill.nta [r3]=r7,16	// r7
+.mem.offset 8,0;	st8.spill.nta [r2]=r6,16	// r6
+.mem.offset 0,0;	st8.spill.nta [r3]=r7,16	// r7
 	;;
 	mov r23=ar.bsp
 	mov r25=ar.unat
@@ -170,9 +171,10 @@
 	st8.nta [r3]=in0		// &__jmp_buf
 	br.call.dpnt.few rp=__sigjmp_save
 .ret0:					// force a new bundle ::q
-	mov r8=0
+	mov.m ar.unat=r16		// restore caller's unat
 	mov rp=loc0
 	mov ar.pfs=loc1
+	mov r8=0
 	ret
 END(__sigsetjmp)
 
Index: sysdeps/unix/sysv/linux/ia64/getcontext.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/ia64/getcontext.S,v
retrieving revision 1.6
diff -u -r1.6 getcontext.S
--- sysdeps/unix/sysv/linux/ia64/getcontext.S	9 Oct 2002 09:57:46 -0000	1.6
+++ sysdeps/unix/sysv/linux/ia64/getcontext.S	27 Mar 2003 19:33:04 -0000
@@ -34,6 +34,7 @@
   other than the PRESERVED state.  */
 
 ENTRY(__getcontext)
+	.prologue
 	alloc r16 = ar.pfs, 1, 0, 3, 0
 
 	// sigprocmask (SIG_BLOCK, NULL, &sc->sc_mask):
@@ -53,7 +54,9 @@
 	add r2 = SC_GR+1*8, r32
 	;;
 	mov.m rBSP = ar.bsp
+	.save ar.unat, rUNAT
 	mov.m rUNAT = ar.unat
+	.body
 	add r3 = SC_GR+4*8, r32
 	;;
 
@@ -65,8 +68,8 @@
 .mem.offset 8,0; st8.spill [r3] = r6, 48
 	and rTMP = ~0x3, rRSC
 	;;
-	st8.spill [r2] = r7, (SC_FR+2*16-(SC_GR+7*8))
-	st8.spill [r3] = sp, (SC_FR+3*16-(SC_GR+12*8))
+.mem.offset 0,0; st8.spill [r2] = r7, (SC_FR+2*16-(SC_GR+7*8))
+.mem.offset 8,0; st8.spill [r3] = sp, (SC_FR+3*16-(SC_GR+12*8))
 	;;
 	mov.m ar.rsc = rTMP 		// put RSE into enforced lazy mode
 	mov.m rNAT = ar.unat
@@ -119,8 +122,8 @@
 	stf.spill [r3] = f31, 32
 	mov rB1 = b1
 	;;
+	mov ar.unat = rUNAT	// we're done spilling integer regs; restore caller's UNaT
 	add r2 = SC_NAT, r32
-	nop 0
 	add r3 = SC_BSP, r32
 	;;
 	st8 [r2] = rNAT, (SC_RNAT-SC_NAT)

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

* Re: ia64: unat restoration fixes for setjmp() & getcontext()
  2003-03-27 19:51 ia64: unat restoration fixes for setjmp() & getcontext() David Mosberger
@ 2003-03-27 21:25 ` Ulrich Drepper
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2003-03-27 21:25 UTC (permalink / raw)
  To: davidm; +Cc: libc-hacker

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

David Mosberger wrote:
> The ia64 versions of __sigsetjmp() and getcontext() failed to restore
> ar.unat before returning.  Patch below should fix that.

Applied.  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+g1Yh2ijCOnn/RHQRAv44AJ9YT74VMT8+A2IB/qeegGzKRuRwdwCfaMi8
wvYdvD9IGD1sEoybW2LIryw=
=7BS5
-----END PGP SIGNATURE-----

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

end of thread, other threads:[~2003-03-27 19:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-27 19:51 ia64: unat restoration fixes for setjmp() & getcontext() David Mosberger
2003-03-27 21:25 ` 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).