On Mon Nov 21 18:14:43 EST 2011, [email protected] wrote:
> it only needs to save the non-register state (ie, the control register
> you'd wondered about),
> but it's free to do more if that's somehow easier, even if the values
> will never be used.
> on BG/P, the equivalent function does:
> * If there isn't a pending exception, just save the
> * initial state and current status, because registers
> * were killed by the system call.
but not the statuses, correct? this is what i'm thinking for
a minimal clone which assumes it will be called from rfork,
but doesn't assume anything about the up using x87 or sse.
static void
sseclonestate(PFPU *t, PFPU *s)
{
Fxsave *r;
memmove(t->fpusave, s->fpusave, sizeof(FPsave));
r = (Fxsave*)t;
r->ftw = 0; /* all x87 registers invalid (clear
stack) */
r->fsw = 0; /* clear x87 status */
r->mxcsr &= ~SSEflags; /* clear sse status; preserve settings
*/
}
- erik