From: Mikael Pettersson <mikpe@it.uu.se>
To: "Clark Cooper" <clark.cooper@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: PROBLEM: Caught SIGFPE exceptions aren't reset
Date: Sat, 25 Aug 2007 12:15:30 +0200 [thread overview]
Message-ID: <18128.322.59087.367556@alkaid.it.uu.se> (raw)
In-Reply-To: <e21d91280708242140i2e6223a4v51ba016837b74be8@mail.gmail.com>
Clark Cooper writes:
> [1] Caught SIGFPE exceptions aren't reset
>
> [2]
> On an i386, you can set a handler for a SIGFPE signal, and after enabling FP
> exceptions with feenableexceptions(), an FP exception will cause
> your handler
> to be called. However after the handler returns, it is called
> again with the
> same FP error. Control never returns to the point after the
> instruction that
> caused the exception.
User error.
You cannot write working SIGFPE handlers without understanding the
underlying FP instruction set and its exception model, and being
prepared to write CPU- and OS-specific code.
In particular, on modern x86, an SSE2 FP instruction that raises
an exception will be set to restart in the resumption state.
It's up to your handler to either bypass the restart (longjmp),
or to update the resumption state so that it can be resumed without
triggering an infinite loop. Your handler can do this by masking
exceptions, changing the operands of the failed FP instruction,
or by changing the PC so that the failed instruction is skipped
(your handler may want to emulate the instruction in this case).
This is not a kernel problem.
/Mikael
next prev parent reply other threads:[~2007-08-25 10:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-25 4:40 Clark Cooper
2007-08-25 10:15 ` Mikael Pettersson [this message]
[not found] ` <e21d91280708251018l4904b6bcm5b40e22b6b2cbedc@mail.gmail.com>
2007-08-25 17:31 ` Clark Cooper
2007-08-29 19:13 ` Chuck Ebbert
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=18128.322.59087.367556@alkaid.it.uu.se \
--to=mikpe@it.uu.se \
--cc=clark.cooper@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®