summaryrefslogtreecommitdiff
path: root/src/thread/cnd_destroy.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2019-09-26 23:46:09 -0400
committerRich Felker <dalias@aerifal.cx>2019-09-26 23:46:09 -0400
commit370679ba984d8a466d635234dc7a3084e98c0071 (patch)
tree87045090bc2ba82ec0927dd46e214595b7e95ae6 /src/thread/cnd_destroy.c
parent9f6dd78593e1d3b06f6e72f8479c91361e28ac28 (diff)
downloadmusl-370679ba984d8a466d635234dc7a3084e98c0071.tar.gz
musl-370679ba984d8a466d635234dc7a3084e98c0071.tar.bz2
musl-370679ba984d8a466d635234dc7a3084e98c0071.tar.xz
musl-370679ba984d8a466d635234dc7a3084e98c0071.zip
fix mips setjmp/longjmp fpu state on r6, related issues
mips32 has two fpu register file variants: FR=0 with 32 32-bit registers, where pairs of neighboring even/odd registers are used to represent doubles, and FR=1 with 32 64-bit registers, each of which can store a single or double. up through r5 (our "mips" arch), the supported ABI uses FR=0, but modern compilers generate "fpxx" model code that can safely operate with either model. r6, which is an incompatible but similar ISA, drops FR=0 and only provides the FR=1 model. as such, setjmp and longjmp, which depended on being able to save and restore call-saved doubles by storing and loading their 32-bit halves, were completely broken in the presence of floating point code on mips r6. to fix this, use the s.d and l.d mnemonics to store and load fpu registers. these expand to the existing swc1 and lwc1 instructions for pairs of 32-bit fpu registers on mips1, but on mips2 and later they translate directly to the 64-bit sdc1 and ldc1. with FR=0, sdc1 and ldc1 behave just like the pairs of swc1 and lwc1 instructions they replace, storing or loading the even/odd pair of fpu registers that can be treated as separate single-precision floats or as a unit representing a double. but with FR=1, they store/load individual 64-bit registers. this yields the ABI-correct behavior on mips r6, and should make linking of pre-r6 (plain "mips") code with "fp64" model code workable, although this is and will likely remain unsupported usage. in addition to the mips r6 problem this change fixes, reportedly clang's internal assembler refuses to assemble swc1 and lwc1 instructions for odd register indices when building for "fpxx" model (the default). this caused setjmp and longjmp not to build. by using the s.d and l.d forms, this problem is avoided too. as a bonus, code size is reduced everywhere but mips1.
Diffstat (limited to 'src/thread/cnd_destroy.c')
0 files changed, 0 insertions, 0 deletions