Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Jan 2002 15:41:59 -0500 (EST)
From:      Daniel Eischen <eischen@pcnet1.pcnet.com>
To:        Nate Williams <nate@yogotech.com>
Cc:        Dan Eischen <eischen@vigrid.com>, Peter Wemm <peter@wemm.org>, Archie Cobbs <archie@dellroad.org>, Alfred Perlstein <bright@mu.org>, arch@FreeBSD.ORG
Subject:   Re: Request for review: getcontext, setcontext, etc
Message-ID:  <Pine.SUN.3.91.1020107153321.18416A-100000@pcnet1.pcnet.com>
In-Reply-To: <15418.518.723982.571226@caddis.yogotech.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 7 Jan 2002, Nate Williams wrote:
> >   Thread 1:
> >   ---------
> >   /* munch some FP stuff */
> >   pthread_yield();  /* allow thread 2 to run */
> >   /* munch some more FP stuff */
> > 
> > Assume that pthread_yield only saves the FP control word (which
> > is what it does currently in libc_r).
> > 
> >   Thread 2:
> >   ---------
> >   /* FP munchy munchy */
> >   pthread_yield();   /* allow thread 1 to run */
> >   /* FP munchy munch munch */
> > 
> > 
> > What FP state exists in registers across the call to
> > pthread_yield().
> 
> *NOW* I understand.  Thanks for being patient with me.
> 
> Here is some code snippets on that note.  (It's been a *LONG* time since
> I looked at this, so be nice to me. :)
> 
> Basically, we do a 'fsave' on an 108 byte array (which is the amount of
> space required to save a complete processor state of the FPU unit on a
> 387), and then later restore the same state.

Ok, but are you sure that the FP state isn't being saved
because it also has to handle restoring thread contexts
interrupted by signals?  I noticed it was using siglongjmp...

If you have a call to a function in the middle of doing
some FP stuff, that function itself could do a slew of
other FP calculations:

  /* FP munch */
  foo_fp_munch_lots_more();
  /* FP munch some more */

What guarantees do you have that the FP state is restored
to where it was prior to calling foo_fp_munch_lots_more()?

-- 
Dan Eischen

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




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