This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ia64: unat restoration fixes for setjmp() & getcontext()


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 at hpl dot hp dot 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)


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