Re: [Qemu-devel] [PATCH v2 0/5] target/m68k: implement 680x0 FPU (part 3)

2017-12-05 Thread william lin
On Wed, Nov 29, 2017 at 9:19 AM, Thomas Huth  wrote:

> On 29.11.2017 15:17, Laurent Vivier wrote:
> > Le 29/11/2017 à 15:08, Thomas Huth a écrit :
> >> On 29.11.2017 14:59, Peter Maydell wrote:
> >>> On 29 November 2017 at 13:42, Laurent Vivier 
> wrote:
>  these functions come from:
> 
>  http://previous.alternative-system.com/
> 
>  http://svn.code.sf.net/p/previous/code/trunk/src/
> softfloat/softfloat.c
> 
>  This is also a modified softfloat, release 2b
>  which is BSD license if I'm correct.
> >>>
> >>> We can't use softfloat2b code (the part of the license that goes
> >>> "USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS
> >>> AND ORGANIZATIONS [...] WHO FURTHERMORE EFFECTIVELY INDEMNIFY JOHN
> >>> HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE INSTITUTE" isn't
> >>> GPL compatible).
> >>>
> >>> We can use softfloat2a code, which doesn't have that indemnity clause.
> >>
> >> Sigh. That's why WinUAE and Hatari immediately switched back to
> >> softfloat2a (derived from QEMU) after we've identified the problem
> >> there. Looks like the Previous folks forgot to do that step, too :-(
> >>
>  This code has also been copied to WinUAE (GPL), where softfloat has
> been
>  copied from QEMU:
>  https://github.com/tonioni/WinUAE/blob/master/softfloat/softfloat.cpp
> >>>
> >>> Yes, lots of projects used the softfloat2b code without realising
> >>> it wasn't GPL compatible (including QEMU -- we had a painful job
> >>> to fix things up and convert to the 2a codebase a while back).
> >>>
>  But I think the bad news comes later:
> 
>  all the other functions (sin, cos, tan, log, exp, ...) found in
> previous
>  (softfloat_fpsp.c) are "derived" from NeXT library FPSP:
> 
>  http://svn.code.sf.net/p/previous/code/trunk/src/
> softfloat/softfloat_fpsp.c
> 
>  /*==
> ==
> 
>   This C source file is an extension to the SoftFloat IEC/IEEE
> Floating-point
>   Arithmetic Package, Release 2a.
> 
>   Written by Andreas Grabher for Previous, NeXT Computer Emulator.
> 
>  
> =*/
>  ...
>  /*--
> --
>  | Algorithms for transcendental functions supported by MC68881 and
> MC68882
>  | mathematical coprocessors. The functions are derived from FPSP
> library.
>  *---
> -*/
> 
>  FPSP library can be found:
> 
>  https://ftp.nice.ch/pub/next/developer/hardware/m68k/
> 
>  And the assembly source code is not free at all:
> 
>  https://ftp.nice.ch/pub/next/developer/hardware/m68k/_
> libFPSP.1.p2.N.s/l_fpsp.h
> 
> 
>  |   Copyright (C) Motorola, Inc. 1991
>  |   All Rights Reserved
>  |
>  |   THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
>  |   The copyright notice above does not evidence any
>  |   actual or intended publication of such source code.
> 
> 
>  So I'm wondering what license apply to the C version found in
> "Previous".
> >>>
> >>> Good question. It's clearly not copied code (since the FPSP library is
> >>> all native m68k assembly), but presumably it's the same algorithms
> >>> transliterated into C...
> >>
> >> There also seem to be other versions of that library available, e.g.:
> >>
> >> https://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/sys/
> arch/m68k/fpsp/l_fpsp.h
> >>
> >> Maybe Andreas (now on CC: ) could clarify which version he used / how
> >> the C sources were developed?
> >
> > Thank you Thomas,
> >
> > This seems to be the same code re-licensed to:
> >
> > MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
> > M68000 Hi-Performance Microprocessor Division
> > M68040 Software Package
> >
> > M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
> > All rights reserved.
> >
> > THE SOFTWARE is provided on an "AS IS" basis and without warranty.
> > To the maximum extent permitted by applicable law,
> > MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
> > INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
> > PARTICULAR PURPOSE and any warranty against infringement with
> > regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
> > and any accompanying written materials.
> >
> > To the maximum extent permitted by applicable law,
> > IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
> > (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
> > PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
> > OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
> > SOFTWARE.  Motorola assumes no responsibility for the maintenance
> > and support of the SOFTWARE.
> >
> > You are hereby granted a c

Re: [Qemu-devel] [PATCH v2 0/5] target/m68k: implement 680x0 FPU (part 3)

2017-12-05 Thread william lin
On Tue, Dec 5, 2017 at 2:01 PM, Laurent Vivier  wrote:

> Le 05/12/2017 à 18:42, Andreas Grabher a écrit :
> >
> > Am 05.12.2017 um 10:46 schrieb Laurent Vivier  > <mailto:laur...@vivier.eu>>:
> >
> >> Le 05/12/2017 à 09:56, william lin a écrit :
> >>> On Wed, Nov 29, 2017 at 9:19 AM, Thomas Huth  >>> <mailto:h...@tuxfamily.org>
> >>> <mailto:h...@tuxfamily.org>> wrote:
> >>>
> >>>On 29.11.2017 15:17, Laurent Vivier wrote:
> >>>> Le 29/11/2017 à 15:08, Thomas Huth a écrit :
> >>>>> On 29.11.2017 14:59, Peter Maydell wrote:
> >>>>>> On 29 November 2017 at 13:42, Laurent Vivier  >>>>>> <mailto:laur...@vivier.eu>
> >>><mailto:laur...@vivier.eu>> wrote:
> >>>>>>> these functions come from:
> >>>>>>>
> >>>>>>> http://previous.alternative-system.com/
> >>><http://previous.alternative-system.com/>
> >>>>>>>
> >>>>>>>
> >>>http://svn.code.sf.net/p/previous/code/trunk/src/
> softfloat/softfloat.c
> >>><http://svn.code.sf.net/p/previous/code/trunk/src/
> softfloat/softfloat.c>
> >>>>>>>
> >>>>>>> This is also a modified softfloat, release 2b
> >>>>>>> which is BSD license if I'm correct.
> >>>>>>
> >>>>>> We can't use softfloat2b code (the part of the license that goes
> >>>>>> "USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS
> >>>>>> AND ORGANIZATIONS [...] WHO FURTHERMORE EFFECTIVELY INDEMNIFY JOHN
> >>>>>> HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE INSTITUTE" isn't
> >>>>>> GPL compatible).
> >>>>>>
> >>>>>> We can use softfloat2a code, which doesn't have that indemnity
> >>>clause.
> >>>>>
> >>>>> Sigh. That's why WinUAE and Hatari immediately switched back to
> >>>>> softfloat2a (derived from QEMU) after we've identified the problem
> >>>>> there. Looks like the Previous folks forgot to do that step, too :-(
> >>>>>
> >>>>>>> This code has also been copied to WinUAE (GPL), where softfloat
> >>>has been
> >>>>>>> copied from QEMU:
> >>>>>>>
> >>>https://github.com/tonioni/WinUAE/blob/master/softfloat/
> softfloat.cpp
> >>> <https://github.com/tonioni/WinUAE/blob/master/softfloat/softfloat.cpp
> >
> >>>>>>
> >>>>>> Yes, lots of projects used the softfloat2b code without realising
> >>>>>> it wasn't GPL compatible (including QEMU -- we had a painful job
> >>>>>> to fix things up and convert to the 2a codebase a while back).
> >>>>>>
> >>>>>>> But I think the bad news comes later:
> >>>>>>>
> >>>>>>> all the other functions (sin, cos, tan, log, exp, ...) found in
> >>>previous
> >>>>>>> (softfloat_fpsp.c) are "derived" from NeXT library FPSP:
> >>>>>>>
> >>>>>>>
> >>>http://svn.code.sf.net/p/previous/code/trunk/src/
> softfloat/softfloat_fpsp.c
> >>><http://svn.code.sf.net/p/previous/code/trunk/src/
> softfloat/softfloat_fpsp.c>
> >>>>>>>
> >>>>>>>
> >>>/*===
> =
> >>>>>>>
> >>>>>>>   This C source file is an extension to the SoftFloat IEC/IEEE
> >>>Floating-point
> >>>>>>>   Arithmetic Package, Release 2a.
> >>>>>>>
> >>>>>>>   Written by Andreas Grabher for Previous, NeXT Computer Emulator.
> >>>>>>>
> >>>>>>>
> >>>=
> */
> >>>>>>> ...
> >>>>>>>
> >>>/*---
> -
> >>>>>>> | Algorithms for transcendental functions supported by MC68881
> >>>and MC68882
> >>>>>>> | mathematical coproc

[Qemu-devel] [Bug 645662] x87 fpu emulation not accurate enough

2017-11-29 Thread william lin
Hello,

I have been looking into this bug
 for a school project, and
after reproducing the bug and tracing through the code, I have run into a
wall trying to figure out the best way to approach this. If there is anyone
who is familiar with qemu's fpu and is willing, any tips or suggestions
will be fantastic.

Thanks,

Will & Wes


Re: [Qemu-devel] [Bug 645662] x87 fpu emulation not accurate enough

2017-11-29 Thread william lin
Hi,

The goal of the project is to fix the bug. Sorry I should have been more
clear.

This bug has been around for 7+ years now. Qemu switched to softfloat and
it did not fix this. I think its most likely caused by Qemu's internal
representation not being accurate enough or accuracy lost during
conversion. However this is basically what is given to us in the bug
report, and I have not been able to make much progress past this point, so
we are asking for help.

Will



On Nov 29, 2017 3:39 AM, "KONRAD Frederic" 
wrote:

Hi,

I have the same problem here with some of our math testsuites.
It's about some precision issue with trigonometric tests.

I didn't had time to figure out what happen neither what is
really going wrong. eg: trigonometric function or?

A quick workaround is to use KVM when possible.

Fred


On 11/29/2017 09:34 AM, william lin wrote:

> Hello,
>
> I have been looking into this bug
> <https://bugs.launchpad.net/qemu/+bug/645662> for a school project, and
>
> after reproducing the bug and tracing through the code, I have run into a
> wall trying to figure out the best way to approach this. If there is anyone
> who is familiar with qemu's fpu and is willing, any tips or suggestions
> will be fantastic.
>
> Thanks,
>
> Will & Wes
>
>


[Qemu-devel] UT Austin Virtualization project

2017-11-10 Thread william lin
Hi all,

My name is William Lin. I am an undergrad student at UT Austin and for our
virtualization class we have to contribute to a open source repo related to
virtualization. I am working in a group of two with about a month of time.
We are both comfortable with virtualization concepts and systems
programming. If there are any ideas or suggestions please let me know it
will be much appreciated. We are looking for any features/issues that would
take a team of two about a month to complete.

Getting the code accepted is not a requirement for our project but is extra
credit and would be preferred.

Thanks,
Will


Re: [Qemu-devel] [PATCH v2 0/5] target/m68k: implement 680x0 FPU (part 3)

2017-12-15 Thread william lin
Hi,

Does anyone know what is the status on this patch? In particular I
need the code from the later patches in Laurent's tree
(sin, cos, etc..) to fix the x87 fpu bug.

>From what I understand, there shouldn't be any licensing issue with the
code as implementation's algorithm was taken from the version of the
asm lib that is GPL compatible. (both versions' algorithms are identical)

As for the Softfloat libraries, Andreas is correct, they are all identical
other than the headers.


I would be happy to create a new patch thread with all the licensing
and sourcing issues summarized for the code in question, however
I'm not sure what would be the best way to go about giving Laurent
credit in the patches.

Thanks,
William

On Wed, Dec 6, 2017 at 4:24 AM, Alex Bennée  wrote:

>
> Laurent Vivier  writes:
>
> > Implement fmod, frem, fscale, fgetman and fgetexp.
> >
> > Instead of using functions of libm (v1 of this series)
> > and converting between host long double and floatx80 type
> > the new version (v2) adds new floatx80 functions in softfloat.
>
> 68k used 80bit float, well TIL ;-)
>
> Just for reference Richard and I did a sprint on hacking the softfloat
> last week. The results are currently brewing in:
>
>   https://github.com/stsquad/qemu/tree/softfloat-and-arm-fp16-v2
>
> The main push has been to decompose 16/32/64 bit floats and have a
> common set of operations. This means we work with an internal 64 bit
> fractional part and then just round appropriately when we pack the
> result. It's a big departure from SoftFloat2a but seeing as we are not
> likely to bring in changes from upstream we felt it was worth it from a
> code clarity point of view.
>
> However we have punted touching the 80bit code and any potential
> quad-precision stuff to a later date, preferably when int128_t is easier
> to use. Perhaps it is worth considering that option now?
>
> >
> > All the floatx80 functions are copied from "Previous",
> > the NeXT Computer Emulator, and written by Andreas Grabher.
> >
> > Laurent Vivier (5):
> >   softfloat: add floatx80_mod()
> >   target/m68k: add fmod/frem
> >   softfloat: use floatx80_infinity in softfloat
> >   softfloat: add floatx80_getman(), floatx80_getexp(), floatx80_scale()
> >   target-m68k: add fscale, fgetman and fgetexp
> >
> >  fpu/softfloat-specialize.h |  29 +
> >  fpu/softfloat.c| 258 ++
> ---
> >  include/fpu/softfloat.h|  13 ++-
> >  target/m68k/cpu.h  |   1 +
> >  target/m68k/fpu_helper.c   |  48 +
> >  target/m68k/helper.h   |   5 +
> >  target/m68k/translate.c|  15 +++
> >  7 files changed, 355 insertions(+), 14 deletions(-)
>
>
> --
> Alex Bennée
>
>