Re: Software FPU emulation in linux kernel

Thorsten Otto
2025-03-04T05:24:42Z

On Montag, 3. März 2025 23:10:12 CET Brad Boyer wrote:
> On the variants without the built-in FPU, it's
> expected that the FPU emulator handles all of it since that's faster
> than triggering the emulator for each FPU instruction used in FPSP.

Yes, that's why i was wondering that a lot of functions are not implemented.

> Well, most programs that use FPU instructions aren't going to use anything
> beyond the basics.

Thats true. But if they do, wouldn't it be better to just abort the program so
the user will notice it, rather than continuing with totally bogus values?
Currently, uprint will just use the kernels printk. I guess that will just end
up in the syslog for most cases, and not even seen by the user.

> The 68881/68882 are kind of unusual in implementing
> all of that in hardware.

Its not really unusual. The x87 FPU has almost the same instructions.

> In practice, no. There's a lot of other issues as well. I seem to
> recall that it only supports the 020/030 and not the versions of
> the 040/060 without FPU.

Thats mostly a matter how it is integrated in the system. That will obviously
be totally different in my case.

> The advice
> has always been to use a full 68040/68060 or add a real 68881/68882
> chip to the 020/030 systems.

Sure. But obviously this is not always possible, otherwise we would not need
an emulator. Nowadays, 68EC040 are much easier to find than full 68040.

> Most existing 68LC040 chips also have the bug that causes missed
> page faults after software-emulated instructions as well

Oh, i didn't know that. But handling pagefaults is another thing. But freemint
does not manage virtual memory, so that should not be a problem here.