why don't setjmp save MXCSR register and x87 control word?

Fengkai Sun qcloud1014@gmail.com
Tue Mar 16 14:39:36 GMT 2021


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


More information about the Libc-help mailing list