Bug in kse_switchin()?

Andrew Belashov bel at orel.ru
Wed Oct 6 23:56:15 PDT 2004


Ken Smith wrote:
> On Thu, Sep 23, 2004 at 02:20:51PM +0400, Andrew Belashov wrote:
> 
> 
>>Where bug?
>>- In sparc64 specific core?
>>- In kern/kern_kse.c and kern/kern_thr.c code?
> 
> 
> Can you humor me and test this patch please?
> 
> Index: sys/conf/kern.pre.mk
> ===================================================================
> RCS file: /home/ncvs/src/sys/conf/kern.pre.mk,v
> retrieving revision 1.57
> diff -u -r1.57 kern.pre.mk
> --- sys/conf/kern.pre.mk        23 Sep 2004 22:53:22 -0000      1.57
> +++ sys/conf/kern.pre.mk        6 Oct 2004 03:09:09 -0000
> @@ -24,7 +24,7 @@
>  . elif ${MACHINE_ARCH} == "ia64"
>  COPTFLAGS?=-O2 -pipe
>  . elif ${MACHINE_ARCH} == "sparc64"
> -COPTFLAGS?=-O2 -pipe
> +COPTFLAGS?=-O -pipe
>  . elif ${MACHINE_ARCH} == "arm"
>  COPTFLAGS?=-O2 -pipe
>  . else
> 
> You'll need to go through a complete kernel build cycle after applying
> it (starting with 'config').

Option -O does not solve a problem.

But I have magic patch. It work with -O and -O2 options.

--
Best regards,
Andrew Belashov.
-------------- next part --------------
--- 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) {


More information about the freebsd-threads mailing list