So far there's not a lot here. My patch to fix mul/div emulation on SPARClinux got accepted into an official snapshot for 2.0.33 so that's no longer around. What we do have is my code to do FPU emulation.
Newer SPARClinux kernels have somewhat different code to do this -- somebody else put in some work on it (since I hadn't done very much after an initial effort...) and so this is all now an irrelevant byway I haven't got round to removing from the website yet...
WARNING! This code is alpha quality and you use it at your own risk! I don't think it will crash the kernel, but I make no guarantees. I certainly don't guarantee that the results of FP calculations will be accurate. FDIVQ is definitely buggy. IEEE exceptions aren't supported. There's an oddity with a precise trap which I haven't tracked down yet. Oh yes, it also spews lots of debugging information to the console/logs. I'll happily accept bug reports; lines of input to tester (see below) which produce different results on SPARClinux and SunOS are most likely to result in fixes. Small fragments of assembly are also OK...
This is the fourth version of this code to be made available here. The previous version is still around but I don't recommend it :-)
Anyway, here's a gzipped tarfile, which you should untar from /usr/src/linux or equivalent. It was developed using a 2.0.33 kernel, so no guarantees about working with anything else [and it almost certainly won't work on 2.1.x kernels, although the fix is pretty trivial, I think.] You should then patch the following files, using the *.diff unified diffs in the arch/sparc/math-emu directory:
Then make config, select experimental options and then select the FP emulation. It should work both in the main kernel and as a module; all my testing has been using the module.
This version has been completely taken apart and reassembled to use inline functions rather than cpp macros: it's much nicer code but unfortunately the module has grown from 70K to 100K in the process... New features in this version include some more bugfixes: I'm now fairly happy with the single and double precision operations. Also, FMULQ and FSQRTQ should work now. The tester program now knows about all the FPops.
The FPop emulation code comes with a
testing program: tester.c
in the arch/sparc/math-emu
directory.
You are intended to run
tester -c < tester.input > tester.outputon a machine whose FPU/OS you trust [ie SunOS or Solaris]. This converts a file of opcodes and operands on stdin to a file of opcodes, operands and expected results on stdout. You then run
tester < tester.outputon the machine whose FP implementation you wish to test. Any discrepancies between the calculated results and those in the file will be moaned about on stderr.
More details are in the source and input files. Further test cases are welcomed (especially boundary conditions and other problem situations).