From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Mon, 21 Nov 2011 20:52:11 -0500 To: 9fans@9fans.net Message-ID: In-Reply-To: References: <93653898c4ceb27355b5fa1e548176aa@brasstown.quanstro.net> <1f44256f014adb8ba778c7fdf5951b43@brasstown.quanstro.net> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] sysrfork fp bug? Topicbox-Message-UUID: 42ffc75c-ead7-11e9-9d60-3106f5b1d025 On Mon Nov 21 18:14:43 EST 2011, charles.forsyth@gmail.com 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