public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
* why don't setjmp save MXCSR register and x87 control word?
@ 2021-03-16 14:39 Fengkai Sun
  2021-03-17 18:59 ` Adhemerval Zanella
       [not found] ` <41f234be-0fbe-0ae1-74be-084bab59bef6@linaro.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Fengkai Sun @ 2021-03-16 14:39 UTC (permalink / raw)
  To: libc-help

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-18 13:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-16 14:39 why don't setjmp save MXCSR register and x87 control word? 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
2021-03-18 13:25     ` Adhemerval Zanella

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).