Subject: Re: set/getcontext problems should be fixed
To: Simon Burge <simonb@wasabisystems.com>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: port-mips
Date: 07/03/2004 15:09:32
This is a multipart MIME message.
--==_Exmh_6382968524660
Content-Type: text/plain; charset=us-ascii
simonb@wasabisystems.com said:
> There's still a problem with an ieee test, but that is unrelated to
> all this.
There are still 3 places where trapsignal() is called with
wrong arguments. On my pmax, I don't hit such a code path, but
on other machines this could be fatal.
The appended patch contains a poor and incomplete workaround.
Fir the ieee tests, last time I looked one failure was caused
by the fact that the double<->float conversions (cvt_s_d and
cvt_d_s in fp.S) don't handle NaNs. Should be relatively easy to
fix, but when the "cache error" issues came up I didn't want
to touch the code until this is solved.
best regards
Matthias
--==_Exmh_6382968524660
Content-Type: text/plain ; name="mipsfp.txt"; charset=us-ascii
Content-Description: mipsfp.txt
Content-Disposition: attachment; filename="mipsfp.txt"
Index: mips/fp.S
===================================================================
RCS file: /cvsroot/src/sys/arch/mips/mips/fp.S,v
retrieving revision 1.28
diff -u -r1.28 fp.S
--- mips/fp.S 25 Oct 2003 22:10:34 -0000 1.28
+++ mips/fp.S 3 Jul 2004 14:06:13 -0000
@@ -4967,7 +4967,7 @@
move a2, a0 # code = instruction
lw a0, _C_LABEL(curlwp) # get current process
li a1, SIGILL
- j _C_LABEL(trapsignal)
+ j _C_LABEL(fpemul_trapsignal)
END(fpemul_sigill)
STATIC_LEAF(fpemul_sigfpe)
@@ -4981,7 +4981,7 @@
move a2, a0 # code = instruction
lw a0, _C_LABEL(curlwp) # get current process
li a1, SIGFPE
- j _C_LABEL(trapsignal)
+ j _C_LABEL(fpemul_trapsignal)
END(fpemul_sigfpe)
#ifdef SOFTFLOAT
@@ -4996,6 +4996,6 @@
move a2, a0 # code = instruction
lw a0, _C_LABEL(curlwp) # get current process
li a1, SIGFPE
- j _C_LABEL(trapsignal)
+ j _C_LABEL(fpemul_trapsignal)
END(bcemul_sigfpe)
#endif
Index: mips/mips_fputrap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/mips/mips/mips_fputrap.c,v
retrieving revision 1.1
diff -u -r1.1 mips_fputrap.c
--- mips/mips_fputrap.c 4 Mar 2004 20:17:01 -0000 1.1
+++ mips/mips_fputrap.c 3 Jul 2004 14:06:13 -0000
@@ -84,3 +84,19 @@
return (fpecodes[i].code);
return (FPE_FLTINV);
}
+
+void fpemul_trapsignal(struct lwp *, unsigned int, unsigned int);
+
+void
+fpemul_trapsignal(struct lwp *l, unsigned int sig, unsigned int code)
+{
+ ksiginfo_t ksi;
+
+ printf("emul_trapsignal(%x,%x)\n", sig, code);
+
+ KSI_INIT_TRAP(&ksi);
+ ksi.ksi_signo = sig;
+ ksi.ksi_code = 1; /* XXX */
+ ksi.ksi_trap = code;
+ (*l->l_proc->p_emul->e_trapsignal)(l, &ksi);
+}
--==_Exmh_6382968524660--