From: Fengkai Sun <qcloud1014@gmail.com>
To: libc-help@sourceware.org
Subject: why don't setjmp save MXCSR register and x87 control word?
Date: Tue, 16 Mar 2021 22:39:36 +0800 [thread overview]
Message-ID: <CAF6YOcOnWpqxsp+tbu-29HHaw7+sj=4jR-ZPcmEq=po6F5u-yg@mail.gmail.com> (raw)
Hi list,
To the best of my knowledge, setjmp have to save all the callee-saved
registers.
According to Sys V ABI:
> The control bits of the MXCSR register are callee-saved (preserved
across calls), while the status bits are caller-saved (not preserved).
> The x87 status word register is caller-saved, whereas the x87 control
word is callee-saved.
But in sysdeps/x86_64/setjmp.S, __sigsetjmp only saves rbx, rbp, r12-r15,
rsp.
I also found an example in FreeBSD, which makes more sense to me:
https://svnweb.freebsd.org/base/head/lib/libc/amd64/gen/_setjmp.S?view=markup
I don't know if there will be any problem if MXCSR and x87 control word are
not saved and get clobbered .
Best,
Fengkai
next reply other threads:[~2021-03-16 14:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-16 14:39 Fengkai Sun [this message]
2021-03-17 18:59 ` Adhemerval Zanella
[not found] ` <41f234be-0fbe-0ae1-74be-084bab59bef6@linaro.org>
2021-03-18 13:02 ` Fengkai Sun
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='CAF6YOcOnWpqxsp+tbu-29HHaw7+sj=4jR-ZPcmEq=po6F5u-yg@mail.gmail.com' \
--to=qcloud1014@gmail.com \
--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).