9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] sysrfork fp bug?
Date: Mon, 21 Nov 2011 20:52:11 -0500	[thread overview]
Message-ID: <b1fb9261d5dcc73c9fa9abc7eb67fae2@chula.quanstro.net> (raw)
In-Reply-To: <CAOw7k5it_OV56ZNnPygDjh+rA=xC-+-x+DJuSWBCBRC-XhXECw@mail.gmail.c>

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



      parent reply	other threads:[~2011-11-22  1:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-21 15:08 erik quanstrom
2011-11-21 15:33 ` Charles Forsyth
     [not found] ` <CAOw7k5hcpmt26NppfrFENPWS9_g6jD=XMhQzVMeS1usGQrwL0w@mail.gmail.c>
2011-11-21 15:43   ` erik quanstrom
2011-11-21 23:01     ` erik quanstrom
2011-11-21 15:48   ` erik quanstrom
2011-11-21 22:08   ` erik quanstrom
2011-11-21 23:14     ` Charles Forsyth
2011-11-21 23:18       ` Charles Forsyth
     [not found]     ` <CAOw7k5it_OV56ZNnPygDjh+rA=xC-+-x+DJuSWBCBRC-XhXECw@mail.gmail.c>
2011-11-22  1:52       ` erik quanstrom [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b1fb9261d5dcc73c9fa9abc7eb67fae2@chula.quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).