Subject: Re: set/getcontext problems should be fixed
To: Matthias Drochner <M.Drochner@fz-juelich.de>
From: Chuck Silvers <chuq@chuq.com>
List: port-mips
Date: 10/16/2005 17:32:15
is this patch still needed in the 3.x branch?  it doesn't look it
was ever checked in.

-Chuck


On Sat, Jul 03, 2004 at 03:09:32PM +0200, Matthias Drochner wrote:
> 
> 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
> 
> 

Content-Description: 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);
> +}