From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] sysrfork fp bug?
Date: Mon, 21 Nov 2011 18:01:40 -0500 [thread overview]
Message-ID: <054a965bf33866efe585d6863a1c1323@chula.quanstro.net> (raw)
In-Reply-To: <b2a3531c72eba1e1f01e352caa6a5de9@brasstown.quanstro.net>
/* don't penalize the child, it hasn't done FP in a note handler. */
p->fpstate = up->fpstate & ~FPillegal;
[...]
ready(p);
sched();
return pid;
we do know that fp->state is FPinactive (because of rfork), but it seems
like this isn't doing what was intended, and if there are any values on the
x87 stack, they could well ... stack, which could lead to eventual fp stack
overflow.
given this discussion, and some prior cleanup i'm currently using this
incantation called from sysrfork in the pc arch dependent code.
fp is a FPArch* to accomidate sse or x87. it's a little gross, but i did
need some sse instructions at one point on a 386 kernel. eventually
the x87 stuff should be killed.
/* called from newproc() since newproc() doesn't know about fpstates */
void
procfpinit(Proc *p)
{
p->fpstate = FPinit;
p->fpusave = (FPsave*)((uintptr)p->fxsave + 15 & ~15);
}
/*
* set up floating point unit before running new process; that is
* turn floating point off and allow the coprocessor not avail.
* trap to initialize the x87/sse on an as-needed basis.
*/
void
procsetup(Proc *p)
{
fp->off();
}
/*
* "clone" the fpu. assume called from rfork() [sic], assume c api (regs dead
* on function call return) [sic, maybe?] so we can get away with discarding the old
* fp state by setting the fpstate to FPinit.
*/
void
clonefpu(PFPU *t, PFPU *s)
{
/* child doesn't inherit fcr, etc.? man page not conclusive */
t->fpstate = FPinit;
USED(s);
}
- erik
next prev parent reply other threads:[~2011-11-21 23:01 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 [this message]
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
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=054a965bf33866efe585d6863a1c1323@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).