User-space context switch and floating-point

Daniel Eischen eischen at vigrid.com
Wed Mar 3 22:43:13 PST 2004


On Thu, 4 Mar 2004, Peter Grehan wrote:

>  > how do you generate code that does:
> > 
> >   double x, y;
> > 
> >   ...
> >   x = y * 1.5 * sqrt(2.25) - 3.15 + pthread_mutex_lock(&m) + 1.25;
> 
>   Substitute integers for float and it's exactly the same problem
> and handled in the same way: the caller saves registers it is using
> for intermediate results prior to the mutex_lock and restores them
> on return according to the calling convention.

So if the caller saves the registers before pthread_mutex_lock(),
why do they also need to be saved by _thr_getcontext (which may
be a result of pthread_mutex_lock() in this example)?

-- 
Dan Eischen



More information about the freebsd-threads mailing list