[ros-dev] [ros-diffs] [dgorbachev] 53907: [NTOSKRNL] Use inline asm in KiIsNpxErrataPresent(). C code can be optimized in a wrong way.

Dmitry Gorbachev d.g.gorbachev at gmail.com
Sat Oct 1 16:38:36 UTC 2011

It is not a compiler fault. The compiler does here two legitimate things:

1) Math can be moved outside _disable/_enable/__writecr0. It can be
fixed by making other local vars volatile.

2) Some time ago, you suggested to look into building with -Ofast
option. So I went agead and compiled with it. GCC replaces division by
multiplication, which causes some loss of precision; thus, the test
fails. This, however, works:

  ErrataPresent = (Value1 / Value2 * 3145727.0) != 4195835.0;

> I hate these kinds of patches.

I do not see a reason for grievance. This handwritten piece is shorter
than compiler-generated code, it is only for i386, there is no need to
port it to arm and amd64, not speaking already that it's just for
"some completely obsolete bs".

More information about the Ros-dev mailing list