Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Dec 2002 00:57:16 -0500 (EST)
From:      Daniel Eischen <eischen@pcnet1.pcnet.com>
To:        Julian Elischer <julian@elischer.org>
Cc:        FreeBSD current users <current@FreeBSD.ORG>
Subject:   Re: x86 FPU discard  question..
Message-ID:  <Pine.GSO.4.10.10212070050570.2837-100000@pcnet1.pcnet.com>
In-Reply-To: <Pine.BSF.4.21.0212061630120.26728-100000@InterJet.elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 6 Dec 2002, Julian Elischer wrote:
> As part of shuting down a thread and discarding it, we want to 
> throw away any floating point context there may be.
> Currently this saves out the floating point state to make the fpu
> be declared 'unused'. However we dont't need any fpu state saved.
> Is there any way to just mark it as 'unused' without bothering to waste
> time saving the current FP context? would just doing
> PCPU_SET(fputhread, NULL);
> be enough?

Hmm, I don't think so.  You really want to drop ownership
without saving and also to get a trap when the next thread
tries to use the FPU.

For i386, fpstate_drop() in machdep.c does this.

> Currently there is an npxexit() in cpu_thread_exit().
> where npxexit() does:
>         savecrit = intr_disable();
>         if (curthread == PCPU_GET(fpcurthread))
>                 npxsave(&PCPU_GET(curpcb)->pcb_save);
>         intr_restore(savecrit);
> 
> My guess is that there needs to be some bit set to tell the hardware
> that it is unused  so that a trap can be generated on the first use by
> another thread.

Yeah, it's done in npxdrop() (called from fpstate_drop()).

-- 
Dan Eischen


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10212070050570.2837-100000>