From: Fengkai Sun <qcloud1014@gmail.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: libc-help@sourceware.org
Subject: Re: why don't setjmp save MXCSR register and x87 control word?
Date: Thu, 18 Mar 2021 21:02:48 +0800 [thread overview]
Message-ID: <CAF6YOcMNfSK9vkRDu298NNgM+WakSErvr41jSXGpjg=t-q+d5g@mail.gmail.com> (raw)
In-Reply-To: <41f234be-0fbe-0ae1-74be-084bab59bef6@linaro.org>
Hello Adhemerval,
Thank you very much for your informative reply!
I think I've figured it out: setjmp and longjmp, though look like function
call
and return, are actually not. Thus their behavior should be defined by
standard
instead of calling conventions, is that correct?
I still have one question here:
On Thu, Mar 18, 2021 at 2:59 AM Adhemerval Zanella <
adhemerval.zanella@linaro.org> wrote:
> Note that standards don't require longjmp to restore either control
> word, and none of Linux, MacOS X 10.3 and earlier, NetBSD, OpenBSD,
> or Solaris do it. However, it is historical FreeBSD behavior, and
> bde points out that it is needed to make longjmping out of a signal
> handler work properly, given the way FreeBSD clobbers the FPU state
> on signal handler entry.
>
>
Does this mean that on FreeBSD, after longjmp to the saved context, the FPU
state will be restored to what it was right after setjmp, while on other
OSs it's not?
Because the situation I think of is that, the call stack between setjmp and
longjmp
may have operations modifying FPU state, but longjmp does not restore it
on
most OSs.
Much appreciated,
Fengkai
next prev parent reply other threads:[~2021-03-18 13:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-16 14:39 Fengkai Sun
2021-03-17 18:59 ` Adhemerval Zanella
[not found] ` <41f234be-0fbe-0ae1-74be-084bab59bef6@linaro.org>
2021-03-18 13:02 ` Fengkai Sun [this message]
2021-03-18 13:25 ` Adhemerval Zanella
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='CAF6YOcMNfSK9vkRDu298NNgM+WakSErvr41jSXGpjg=t-q+d5g@mail.gmail.com' \
--to=qcloud1014@gmail.com \
--cc=adhemerval.zanella@linaro.org \
--cc=libc-help@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).