Unexpected FPU exception in top utility
|Reported by:||Stanislav Kozina||Owned by:|
|Blocker for:||Depends on:|
Sometimes I got FPU exception (number 16) when computing percentages using floating point instruction in `top' utility.
The exception was detected when running on two ia32 CPUs under qemu-kvm simulator, using one CPU there was no problem. But the exception depends on many other things - changing message echoed by printf on very different place can change if the FPU exception rises or not.
There is a branch to preserve this behaviour:
In the branch there is the skeleton of the
top' utility, which still sometimes emits the exception. If you get this branch, compile, run system (rather on pair ia32 CPUs), run top' and press few keys on the keyboard, you should get the exception.
top' utility still retrieves some data from kernel, but these are just to get some random numbers. You can replace them with hardcoded values, but then you have to compile top' with -O0 flag, otherwise compiler removes FPU computation at all.
The only other thing, which still remains in the code, is the
tgetchar' method, which was copied from tetris'. This one probably really causes the exception, because without it I was not able to get it.