Subject: 2.0 panic problem: workaround
To: None <simonb@netbsd.org, port-mips@netbsd.org, port-sgimips@netbsd.org>
From: Christopher SEKIYA <sekiya@NetBSD.org>
List: port-sgimips
Date: 06/13/2004 21:35:12
All,

As the release date for 2.0 nears, I've started to become a bit nervous about
the state of MIPS support in the 2.0 branch -- specifically, the csh/sshd
panics.

Appended is a diff that backs out the specific commit that broke MIPS.  It's
a bit of a hack, as the working sigreturn was subsequently wrapped in a
COMPAT_16 ... as such, 2.0 kernels will need COMPAT_16.

I have tested this on my Indigo.  I'd appreciate feedback from users of other
platforms -- I have placed a sgimips-specific snapshot at
http://www.rezrov.net/netbsd/sgimips-2.0 so that others can easily test this.

If there are no valid objections within the next 48 hours, I'll submit the
patch (and a patch that adds comments to arch/*mips/conf/* explaining why
COMPAT_16 is necessary) to releng for immediate pullup to 2.0.

Thanks,

-- Chris
	GPG key FEB9DE7F (91AF 4534 4529 4BCC 31A5  938E 023E EEFB FEB9 DE7F)

Index: lib/libc/arch/mips/gen/Makefile.inc
===================================================================
RCS file: /cvsroot/src/lib/libc/arch/mips/gen/Makefile.inc,v
retrieving revision 1.24
diff -u -r1.24 Makefile.inc
--- lib/libc/arch/mips/gen/Makefile.inc	23 Mar 2004 12:31:52 -0000	1.24
+++ lib/libc/arch/mips/gen/Makefile.inc	13 Jun 2004 10:23:44 -0000
@@ -15,7 +15,7 @@
 SRCS+=	flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
 	fpsetround.c fpsetsticky.c
 
-SRCS+=	setjmp.S __setjmp14.S __longjmp14.c
+SRCS+=	setjmp.S __setjmp14.S
 SRCS+=	_setjmp.S
 SRCS+=	sigsetjmp.S __sigsetjmp14.S
 SRCS+=	byte_swap_2.S byte_swap_4.S bswap64.c
Index: lib/libc/arch/mips/gen/__setjmp14.S
===================================================================
RCS file: /cvsroot/src/lib/libc/arch/mips/gen/__setjmp14.S,v
retrieving revision 1.10
diff -u -r1.10 __setjmp14.S
--- lib/libc/arch/mips/gen/__setjmp14.S	23 Mar 2004 02:21:49 -0000	1.10
+++ lib/libc/arch/mips/gen/__setjmp14.S	13 Jun 2004 10:23:45 -0000
@@ -130,6 +130,23 @@
 	move	v0, zero
 	j	ra
 	REG_EPILOGUE
+END(__setjmp14)
+
+LEAF(__longjmp14)
+#ifdef __ABICALLS__
+	.set	noreorder
+	.cpload	t9
+	.set	reorder
+	subu	sp, sp, 32
+	.cprestore 16
+#endif
+	REG_PROLOGUE
+	/* save return value in sc_regs[_R_V0] */
+	REG_S	a1,(_OFFSETOF_SC_REGS + _R_V0 * SZREG)(a0)
+	REG_EPILOGUE
+	li	v0, SYS_compat_16___sigreturn14
+	syscall
 botch:
+	jal	_C_LABEL(longjmperror)
 	jal	_C_LABEL(abort)
-END(__setjmp14)
+END(__longjmp14)