Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Aug 2001 21:41:24 -0700
From:      Peter Wemm <peter@wemm.org>
To:        David Malone <dwmalone@maths.tcd.ie>
Cc:        Kevin Day <toasty@temphost.dragondata.com>, hackers@FreeBSD.ORG
Subject:   Re: XMM[0-7] preserved across context switch? 
Message-ID:  <20010823044124.12EE8380F@overcee.netplex.com.au>
In-Reply-To: <20010821184710.A23874@walton.maths.tcd.ie> 

next in thread | previous in thread | raw e-mail | index | archive | help
David Malone wrote:
> On Tue, Aug 21, 2001 at 11:27:38AM -0500, Kevin Day wrote:
> > A quick peek at swtch.s seems to show that the SSE registers (XMM0-7) aren'
    t
> > being preserved across context switches. Am I missing somewhere that's doin
    g
> > this, or are they really not being saved now?
> 
> SSE support has recently been added to -current and -stable.

Yes, but the question was "how is it preserved"?  The SSE stuff works the
same as the FPU stuff in that it is switched lazily.  See npxsave() and
where it is called.  If a process "attaches" to the fpu, its state is kept
in the fpu the whole time.  It is not extracted at context switch time.
So, we can be running a different process while the fpu/xmm stuff is holding
the original process's context.  If the new process tries to use the SSE/fpu
stuff, a trap happens, we save the original process's context in the original
pcb and then give ownership to the new process.

And for SMP, we handle it differently again. :-/

Cheers,
-Peter
--
Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au
"All of this is for nothing if we don't go to the stars" - JMS/B5


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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010823044124.12EE8380F>