does this fail same way on real machine as well? <br><br>On Monday, September 23, 2013, Hongxu Jia <<a href="mailto:hongxu.jia@windriver.com">hongxu.jia@windriver.com</a>> wrote:<br>> On 09/23/2013 04:55 PM, Hongxu Jia wrote:<br>
>><br>>> *Preparation<br>>> 1, vim local.conf<br>>> ...<br>>> DISTRO ?= "poky-lsb"<br>>> MACHINE ?= "qemux86-64"<br>>> ...<br>>><br>>> *Problem<br>
>> 1, Build core-image-lsb<br>>> ..<br>>> bitbake core-image-lsb<br>>> ..<br>>><br>>> 2, Start qemux86-64, there are 21 LSB tcl test failures on<br>>> qemux86-64, you could reproduce it by tcl interpreter:<br>
>> 1, On qemux86-64's terminal, start tcl interpreter<br>>> root@qemux86-64:~# $ tclsh<br>>> %<br>>><br>>> 2, Run 'binary scan' to assign ieeeValues(-Subnormal)<br>>> % binary scan \x00\x00\x00\x00\x00\x00\x08\x80 d ieeeValues(-Subnormal)<br>
>> 1<br>>><br>>> 3, Run 'puts' to output ieeeValues(-Subnormal), the result is '0.0'<br>>> % puts $ieeeValues(-Subnormal)<br>>> -0.0<br>>><br>>> Expected:<br>
>> -1.1125369292536007e-308<br>>><br>>> *Analysis<br>>> 1, On the previous environment, add IMAGE_INSTALL_append = " tcl" to<br>>> local.conf and build core-image-sato, the result is expected.<br>
>><br>>> 2, Trace tcl's source code, you could also reproduce the issue by<br>>> compiling and executing the following C codes on core-image-lsb-sdk.<br>>><br>>> 1) Build core-image-lsb-sdk, and Run qemux86-64.<br>
>> 2) On target's terminal, create a C source file:<br>>> root@qemux86-64:~# cat >> test.c << EOF<br>>> #include <stdio.h><br>>><br>>> int main(int argc, char *argv[])<br>
>> {<br>>> double dd = 0;<br>>> char *p = (char*)&dd;<br>>> p[0] = 0x00;<br>>> p[1] = 0x00;<br>>> p[2] = 0x00;<br>>> p[3] = 0x00;<br>>> p[4] = 0x00;<br>
>> p[5] = 0x00;<br>>> p[6] = 0x08;<br>>> p[7] = 0x00;<br>>><br>>> if (dd == 0.0)<br>>> printf("Incorrect equal 0.0\n");<br>>> else<br>>> printf("Expected not equal 0.0\n");<br>
>><br>>> return 0;<br>>> }<br>>> EOF<br>>><br>>> 2) Compile test.c<br>>> root@qemux86-64:~# gcc test.c -o test<br>>><br>>> 3, Execute test<br>>> $ root@qemux86-64:~# ./test<br>
>> Incorrect equal 0.0<br>>><br>>> Expected:<br>>> Expected not equal 0.0<br>>><br>>> 3, It's about x86-64's FPU: the SSE MXCSR register.<br>>> If you invoke 'feenableexcept(FE_INEXACT);' or<br>
>> 'feclearexcept(FE_INEXACT);' in the above C test,<br>>> the issue will be fixed. In these two functions,<br>>> the SSE MXCSR register has been handled.<br>><br>> vim eglibc-2.18/libc/sysdeps/x86_64/fpu/feenablxcpt.c<br>
> ...<br>> #include <fenv.h><br>><br>> int<br>> feenableexcept (int excepts)<br>> {<br>> unsigned short int new_exc, old_exc;<br>> unsigned int new;<br>><br>> excepts &= FE_ALL_EXCEPT;<br>
><br>> /* Get the current control word of the x87 FPU. */<br>> __asm__ ("fstcw %0" : "=m" (*&new_exc));<br>><br>> old_exc = (~new_exc) & FE_ALL_EXCEPT;<br>><br>> new_exc &= ~excepts;<br>
> __asm__ ("fldcw %0" : : "m" (*&new_exc));<br>><br>> /* And now the same for the SSE MXCSR register. */<br>> __asm__ ("stmxcsr %0" : "=m" (*&new));<br>><br>
> /* The SSE exception masks are shifted by 7 bits. */<br>> new &= ~(excepts << 7);<br>> __asm__ ("ldmxcsr %0" : : "m" (*&new));<br>><br>> return old_exc;<br>> }<br>
> ...<br>><br>> //Hongxu<br>><br>>> *Solution<br>>> Is it necessary to invoke 'feenableexcept(FE_INEXACT);' or<br>>> 'feclearexcept(FE_INEXACT);' to handle SSE MXCSR register?<br>
>><br>>> Or any good idea about this issue.<br>>><br>>> Thanks,<br>>> Hongxu<br>>><br>>><br>>><br>>><br>><br>> _______________________________________________<br>
> Openembedded-core mailing list<br>> <a href="mailto:Openembedded-core@lists.openembedded.org">Openembedded-core@lists.openembedded.org</a><br>> <a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core">http://lists.openembedded.org/mailman/listinfo/openembedded-core</a><br>
>