Re: QEMU Malta emulation using I6400: runaway loop modprobe binfmt-464c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Stuart,

> >  First is rebuilding your userland for the 2008 NaN encoding.  I'm sure 
> > someone already did it, but I don't have a pointer at hand.  This might be 
> > the best option however.
> 
> This will be a lengthy process, is there a particular compiler flag I
> should be using for that?  `man gcc` seems to mention the following:
> 
> >        -mabs=2008
> >        -mabs=legacy
> >            These options control the treatment of the special not-a-number (NaN) IEEE 754 floating-point data with the "abs.fmt" and "neg.fmt"
> >            machine instructions.
> > 
> >            By default or when -mabs=legacy is used the legacy treatment is selected.  In this case these instructions are considered arithmetic and
> >            avoided where correct operation is required and the input operand might be a NaN.  A longer sequence of instructions that manipulate the
> >            sign bit of floating-point datum manually is used instead unless the -ffinite-math-only option has also been specified.
> > 
> >            The -mabs=2008 option selects the IEEE 754-2008 treatment.  In this case these instructions are considered non-arithmetic and therefore
> >            operating correctly in all cases, including in particular where the input operand is a NaN.  These instructions are therefore always used
> >            for the respective operations.
> > 
> >        -mnan=2008
> >        -mnan=legacy
> >            These options control the encoding of the special not-a-number (NaN) IEEE 754 floating-point data.
> > 
> >            The -mnan=legacy option selects the legacy encoding.  In this case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
> >            significand field being 0, whereas signalling NaNs (sNaNs) are denoted by the first bit of their trailing significand field being 1.
> > 
> >            The -mnan=2008 option selects the IEEE 754-2008 encoding.  In this case qNaNs are denoted by the first bit of their trailing significand
> >            field being 1, whereas sNaNs are denoted by the first bit of their trailing significand field being 0.
> > 
> >            The default is -mnan=legacy unless GCC has been configured with --with-nan=2008.
> 
> If I understand correctly, the right thing to do would be to use
> -mnan=2008 then?

 I suggest keeping the two settings in sync, because this is what in 
reality hardware does even though the architecture allows them to be 
independent (which is also why these are two separate settings).  That is 
`-mnan=2008 -mabs=2008' or `-mnan=legacy -mabs=legacy'.

 You could also configure GCC itself with one of the `--with-nan=2008' and 
`--with-nan=legacy' options, which would set the defaults for both 
`-mnan=' and `-mabs=' settings accordingly.  In the absence of the 
`--with-nan=' option in the configuration process GCC defaults to 
inferring the `-mnan=' and `-mabs=' settings from the architecture 
specified with `-march=', which is `legacy' for `mips32r5'/`mips64r5' and 
older, or `2008' for `mips32r6'/`mips64r6' (and likewise according to the 
architecture level implemented by any specific processor requested with 
`-march=').

 NB the default for `-march=' can also be specified in configuration, with 
the use of the `--with-arch=' option.

>  What's the effect on pre-2008 CPUs?

 The same as with running legacy-NaN software on a 2008-NaN processor -- 
by default the kernel will refuse execution of such a binary, or you can 
use the kernel options I quoted to change that, and likewise with the 
`ieee754=relaxed' option you risk incorrect results, including a possible 
crash.  There is symmetry here.

  Maciej




[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux