Bug in kse_switchin()?

Ken Smith kensmith at cse.Buffalo.EDU
Thu Oct 7 06:14:00 PDT 2004


On Thu, Oct 07, 2004 at 10:55:58AM +0400, Andrew Belashov wrote:

> Option -O does not solve a problem.
> 
> But I have magic patch. It work with -O and -O2 options.

Thanks for testing.  I'm not sure what I'll do about the -O stuff yet.
Given it seems to solve one problem that other people I respect couldn't
explain I'll probably revert to -O for the 5.3-RELEASE and do some
more testing to see how widespread a problem it is.

> --- sys/sparc64/sparc64/machdep.c.orig	Thu Aug  5 09:42:40 2004
> +++ sys/sparc64/sparc64/machdep.c	Tue Sep 28 15:11:08 2004
> @@ -623,6 +623,11 @@ set_mcontext(struct thread *td, const mc
>  	tf = td->td_frame;
>  	pcb = td->td_pcb;
>  	wstate = tf->tf_wstate;
> +	/* XXXKSE Make sure the windows are spilled.
> +	 * This is needed for kse_switchin(2) for correct switching between
> +	 * threads stacks.
> +	 */
> +	flushw();
>  	bcopy(mc, tf, sizeof(*tf));
>  	tf->tf_wstate = wstate;
>  	if ((mc->mc_fprs & FPRS_FEF) != 0) {

And thank you very much for that!  I'm testing it now, and will commit
it if nothing unexpected happens.

-- 
						Ken Smith
- From there to here, from here to      |       kensmith at cse.buffalo.edu
  there, funny things are everywhere.   |
                      - Theodore Geisel |


More information about the freebsd-threads mailing list