Unless I made a mistake in the code that verifies fpu state corruption 
which showed no corruption I think it might be worth to ponder possibility 
of different nature of the root cause of this and other issues where 
fmt_fp() shows up in the stack trace.

What if the problem is actually caused by wrong/incompatible compiler 
options that drive what machine code is generated to handle floating point 
operation. For example I noticed that when I configured musl independently 
on my machine I saw it add following options related to floating point math:

CFLAGS_C99FSE = -std=c99 -nostdinc -ffreestanding -*fexcess-precision=*
*standard* *-frounding-**math* -Wa,--noexecstack

I have not enough experience to make any conclusive observations but two of 
those -fexcess-precision and -frounding-math do affet code using float, 
double, long double etc. I did not see those in main OSv makefile so I 
wonder if musl compiled code is wrong and misbehaves.

I think FPU has control word with RC fields that control rounding 
(http://www.website.masmforum.com/tutorials/fptute/fpuchap1.htm) what if 
our code setups FPU rounding that is incompatible with how we compile musl. 
Just wild theory. 

Adding musl math library documentation - 
https://wiki.musl-libc.org/mathematical-library.html- there are paragraphs 
that talk about rounding and precision.

On Thursday, November 29, 2018 at 2:33:26 PM UTC-5, Waldek Kozaczuk wrote:
>
> I wonder if per this - https://software.intel.com/en-us/node/523375 - we 
> are enabling correct bits for xsave if caste is what being used here. 
>
> “The second operand is a save/restore mask specifying the saved/restored 
> extended states. The value of the mask is ANDed with 
> XFEATURE_ENABLED_MASK(XCR0). A particular extended state is saved/restored 
> only if the corresponding bit of both save/restore mask and 
> XFEATURE_ENABLED_MASK is set to '1'.”

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to